A C program to Find distance between two points
#include<stdio.h>
#include<conio.h>
#include<math.h>
struct line
{
struct point
int x;
int y;
}a,b;
} l;
void main()
{
float d;
clrscr();
printf("Enter the co-ordinate of A\n");
scanf("%d%d",&l.a.x,&l.a.y);
printf("\nEnter the co-ordinate of B\n");
scanf("%d%d",&l.b.x,&l.b.y);
d=sqrt(((l.b.x-l.a.x)*(l.b.x-l.a.x))+((l.b.y-l.a.y)*(l.b.y-l.a.y)));
printf("\n\n\nThe distance between A and B is %f",d);
getch();
}
|