1305- Area of a Parallelogram

Problem Link


<Source Code>

#include<stdio.h>
int main()
{
int ax,ay,bx,by,cx,cy,res,dx,dy,t,i;
scanf(“%d”,&t);
for(i=0;i<t;i++)
{res=0;
scanf(“%d %d %d %d %d %d”,&ax,&ay,&bx,&by,&cx,&cy);
dx=(ax+cx)-bx;
dy=(ay+cy)-by;
res=((ax*by+bx*cy+cx*dy+dx*ay))-((ay*bx+by*cx+cy*dx+dy*ax));
if(res<0)
res*=-1;
res=res*.5;
printf(“Case %d: %d %d %d\n”,i+1,dx,dy,res);

}
return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s