Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int metro(int A[2],int B[2])
- {
- int e,f,z;
- e = (B[0]-A[0])*(B[0]-A[0]);
- f = (B[1]-A[1])*(B[1]-A[1]);
- z = pow(e + f,1/2);
- return z;
- }
- int main()
- {
- int a[2],b[2],c[2],d,e,f;
- printf("\ndwse 2 times x kai y gia kathena apo ta 3 simeia");
- scanf("%d%d%d%d%d%d",&a[0],&a[1],&b[0],&b[1],&c[0],&c[1]);
- printf("\ntha dwsw twra ta AB BC CA");
- printf("\n%d\n%d\n%d",metro(a,b),metro(b,c),metro(c,a));
- d = pow((pow((b[0]-a[0]),2)+pow((b[1]-a[1]),2)),1/2);
- e = pow((pow((c[0]-b[0]),2)+pow((c[1]-b[1]),2)),1/2);
- f = pow((pow((a[0]-c[0]),2)+pow((a[1]-c[1]),2)),1/2);
- printf("%d %d %d",d,e,f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement