Contact Learn C
Copy

Program 380: Distance between 2 Points

Program 380: Distance between 2 Points
 
#include<stdio.h>
#include<math.h>
main()
{
 int x1,x2,y1,y2;
 double distance;
 printf("Enter x1\n");
 scanf("%d",&x1);
 printf("Enter y1\n");
 scanf("%d",&y1);
 printf("Enter x2\n");
 scanf("%d",&x2);
 printf("Enter y2\n");
 scanf("%d",&y2);
 distance=sqrt((pow((x2-x1),2))+(pow((y2-y1),2)));
 printf("Distance=%lf\n",distance);
}
Explanation:
 //Coming Soon


Output:
Distance between 2 Points


Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide