Friday, October 26, 2018

Uri 1015 solution in C | Distance Between Two Points

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
#include<math.h>
main()
{
    double x1,y1,x2,y2,d;
    scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
    d=sqrt(((y2-y1)*(y2-y1))+((x2-x1)*(x2-x1)));

    printf("%.4lf\n",d);
    return 0;
}

 //Happy_Coding

No comments:

Post a Comment