Area of a Triangle

From ElectronicWar

Jump to: navigation, search
Challenge Information for Area of a Triangle
Challenge Area of a Triangle
Code 14
Input Example 1,2,0,0,3,0
Output Example 3
Level 50
Profit $4200
Experience 240 to each stat
Description Given three points, return the area of the triangle.


[edit] Solution

int x1 = getInputInt();
int y1 = getInputInt();
int x2 = getInputInt();
int y2 = getInputInt();
int x3 = getInputInt();
int y3 = getInputInt();
 
int b = x3 - x2;
int h = y1 - y3;
int area = b * h/2;
setOutputInt(area);
Personal tools