Guest User

Untitled

a guest
Oct 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. float distance(float *x1, float *y1, float *x2, float *y2);
  6.  
  7. int main()
  8. { printf("Input coordinates as x1,y1,x2,y2:n");
  9. float x1,y1,x2,y2;
  10. scanf("%f %f %f %f ",&x1,&y1,&x2,&y2);
  11.  
  12. printf("Coordinates are : (%f,%f) and (%f,%f)n",x1,y1,x2,y2);
  13. printf("%f",distance (&x1,&y1,&x2,&y2));
  14. return 0;
  15. }
  16.  
  17. float distance(float *x1, float *y1, float *x2, float *y2)
  18. {
  19. float d= sqrt(pow((*x1-*x2),2)+pow((*y1-*y2),2));
  20. printf("%f", d);
  21. return d;
  22. }
  23.  
  24. Input coordinates as x1,y1,x2,y2:
  25. 1 2 3 4
Add Comment
Please, Sign In to add comment