Monday, November 17, 2014

Distance of two point

 

Distance of two point

 

//distance of two point
 
#include<stdio.h>
int main ()
{
    int x1,x2,y1,y2;
    float dist;
    printf("Enter (x1,y1) :");
    scanf("%d %d",&x1,&x2);
    printf("Enter (x2,y2) :");
    scanf("%d %d",&y1,&y2);
    dist = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    printf("\nDistance is %f\n\n", dist);
    return 0;
}

No comments:

Post a Comment