Code:
#include<stdio.h>
#include<math.h>
float findDistance(int,int,int,int);
int main()
{
int x1,x2,y1,y2;
float r=0;
scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
r=findDistance(x1,y1,x2,y2);
printf("Distance between the 2 points is %.2f",(float)r );
return 0;
}
float findDistance(int x1, int y1, int x2, int y2)
{
float d;
d=sqrt((pow(x2-x1,2))+(pow(y2-y1,2)));
return d;
}
No comments