Try to use functional decomposition to break your program into smaller, more manageable pieces. This will make it easier to write, test, and debug.
Where appropriate, consider using the functions get_floating_point() and put_floating_point() defined in the example program sum2.c. You can simply cut and past the relevant section of that program into your own program.
Define a new function of your own, which deals with printing
out the results, for one cycle of your calculations. This
can then be simply called or invoked from within the
while loop of your main() function - which
should make the main() function shorter and easier to
follow. Note that this function will have to accept two arguments
(being the current values for the and
co-ordinates).