Advertisement
Guest User

Area of parralelogram

a guest
Feb 21st, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,dx,dy,area;
  5.     double ax,ay,bx,by,cx,cy,x,y,t;
  6.     scanf("%lf",&t);
  7.  
  8.  
  9.     for(i=1;i<=t;i++){
  10.  
  11.     scanf("%lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy);
  12.  
  13.     x=(ax+cx)/2;
  14.     y=(ay+cy)/2;
  15.  
  16.     dx=(2*x)-bx;
  17.     dy=(2*y)-by;
  18.  
  19.     area=.5*( (ax*by+bx*cy+cx*dy+dx*ay)-(ay*bx+by*cx+cy*dx+dy*ax) );
  20.  
  21.     if(area<0){area=area*-1; }
  22.  
  23.  
  24.     printf("Case %d: %d %d %d\n",i,dx,dy,area);
  25.  
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement