//C Function distance that calculates the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of type double.
#include<stdio.h>
#include<math.h>
float findDistance(int,int,int,int);
int main()
{
int x1,x2,y1,y2;
float r=0;
printf("Two Points (x1,x2) & (y1,y2) : \n");
printf("Enter x1:");
scanf("%d",&x1);
printf("Enter x2:");
scanf("%d",&x2);
printf("Enter y1:");
scanf("%d",&y1);
printf("Enter y2:");
scanf("%d",&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;
}