URI Online Judge Solution| 1015 Distance Between Two Points

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Distance Between Two Points

Adapted by Neilor Tonin, URI  Brazil | Timelimit: 1

Read the four values corresponding to the x and y axes of two points in the plane, p1 (x1, y1) and p2 (x2, y2) and calculate the distance between them, showing four decimal places after the comma, according to the formula:

URI Online Judge Solution| 1015 Distance Between Two Points 1

Distance = 


The input file contains two lines of data. The first one contains two double values: x1 y1 and the second one also contains two double values with one digit after the decimal point: x2 y2.


Calculate and print the distance value using the provided formula, with 4 digits after the decimal point.

Input SampleOutput Sample
1.0 7.0
5.0 9.0
-2.5 0.4
12.1 7.3
2.5 -0.4
-12.2 7.0


#include <stdio.h>
int main()
    double x1,y1,x2,y2,p;
    scanf("%lf %lf",&x1,&y1);
    scanf("%lf %lf",&x2,&y2);
    return 0;

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Do You Want To Contact With me?

drop us a line and keep in touch