Advertisement
Guest User

Untitled

a guest
May 24th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5.  
  6. int metro(int A[2],int B[2])
  7. {
  8.     int e,f,z;
  9.     e = (B[0]-A[0])*(B[0]-A[0]);
  10.     f = (B[1]-A[1])*(B[1]-A[1]);
  11.     z = pow(e + f,1/2);
  12.     return z;
  13.  
  14. }
  15.  
  16. int main()
  17. {
  18.     int a[2],b[2],c[2],d,e,f;
  19.     printf("\ndwse 2 times x kai y gia kathena apo ta 3 simeia");
  20.     scanf("%d%d%d%d%d%d",&a[0],&a[1],&b[0],&b[1],&c[0],&c[1]);
  21.     printf("\ntha dwsw twra  ta AB BC CA");
  22.     printf("\n%d\n%d\n%d",metro(a,b),metro(b,c),metro(c,a));
  23.     d = pow((pow((b[0]-a[0]),2)+pow((b[1]-a[1]),2)),1/2);
  24.     e = pow((pow((c[0]-b[0]),2)+pow((c[1]-b[1]),2)),1/2);
  25.     f = pow((pow((a[0]-c[0]),2)+pow((a[1]-c[1]),2)),1/2);
  26.     printf("%d  %d   %d",d,e,f);
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement