A C Program to find out distance between two points (x1,y1) and(x2,y2).



#include<stdio.h>
#include<conio.h>

void main()
{
int d,x1,x2,y1,y2;
printf("Enter value of x1,y1,x2,y2:");
scanf("%d %d %d %d",&x1 ,&y1 ,&x2 &y2);
printf("Enterred points are as below");
printf("(%d,%d)",x1,y1);
printf("(%d,%d)",x2,y2);
d=sqrt(pow((x2-x1),2)+pow((y2-y1),2);
printf("Distance between (x1,y1) and (x2,y2):%d,d);
getch();
}

Comments