Advertisement
lucontre

practica 7 jercicop 0

Jun 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. typedef struct {
  5. float x;
  6. float y;
  7. }punto2D;
  8. float modulo(punto2D a,punto2D b);
  9. int main()
  10. {
  11.    punto2D p1,p2;
  12.    p1.x=2;
  13.    p1.y=3;
  14.    p2.x=4;
  15.    p2.y=6;
  16.    printf("%.2f",modulo(p1,p2));
  17.     return 0;
  18. }
  19. float modulo(punto2D a, punto2D b){
  20.  return pow( pow(b.x - a.x,2)+pow(b.y - a.y,2) ,0.5);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement