Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- float distance(float *x1, float *y1, float *x2, float *y2);
- int main()
- { printf("Input coordinates as x1,y1,x2,y2:n");
- float x1,y1,x2,y2;
- scanf("%f %f %f %f ",&x1,&y1,&x2,&y2);
- printf("Coordinates are : (%f,%f) and (%f,%f)n",x1,y1,x2,y2);
- printf("%f",distance (&x1,&y1,&x2,&y2));
- return 0;
- }
- float distance(float *x1, float *y1, float *x2, float *y2)
- {
- float d= sqrt(pow((*x1-*x2),2)+pow((*y1-*y2),2));
- printf("%f", d);
- return d;
- }
- Input coordinates as x1,y1,x2,y2:
- 1 2 3 4
Add Comment
Please, Sign In to add comment