Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main(){
- double x1,x2,x3,y1,y2,y3,n,i,kel,luas,a,b,c;
- scanf("%lf", &n);
- for(i=0;i<n;i++)
- { luas=0;
- scanf("%lf%lf%lf%lf%lf%lf", &x1,&y1,&x2,&y2,&x3,&y3);
- // a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
- // b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
- // c=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
- // printf("%.2f %.2f %.2f\n",a,b,c);
- //kel=a+b+c;
- // luas=sqrt(kel*(kel-a)*(kel-b)*(kel-c));
- luas =fabs(-x2*y1 +x3*y1 +x1*y2-x3*y2-x1*y3+x2*y3);
- printf("%.2lf\n",luas/2);
- } return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement