Question 5 Suppose Variables X1 Y1 X2 Y2 Defined Double Assigned Appropriate Values X1 Y1 Q27275635

Question 5: Suppose that the variables x1, y1, x2, y2 are definedas double and they have been assigned appropriate values. (x1,y1)are the coordinates of a point P1 in 2D and (x2,y2) are thecoordinates of a point P2 in 2D. Write the C statements that willcalculate the Euclidean distance between P1 and P2 and displays theresults asfollows:               [7 Marks]

“ ****Distance Calculator Program****

Distance between (x1,y1) and (x2,y2) = d

****Thank you for using our software**** ” In the above output, x1,y1, x2, y2, and d should be replaced dynamically by the valuesassigned to the variables with two decimal places displayed. Forexample if x1 = 0, y1 = 0, x2 = 1, y2 = 1 the program output shouldbe:   ****Distance Calculator Program****

Distance between (0.00,0.00) and (1.00,1.00) = 1.41

****Thank you for using our software****

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *