/* to calculate distance between two points */
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
float x1,y1,x2,y2,d;
printf("Enter (x1,y1); seperated by space: ");
scanf("%f%f",&x1,&y1);
printf("Enter (x2,y2); seperated by space: ");
scanf("%f%f",&x2,&y2);
d=sqrt(pow((x2-x1),2)+(pow((y2-y1),2)));
printf("The distance between two points is: %f",d);
system("pause");
return 0;
}
No comments:
Post a Comment