Area of a Triangle
From Hack Wars Wiki
Outdated and challenge answer, should be deleted. - aoi
| Challenge Information for Area of a Triangle | |
| Challenge | Area of a Triangle |
| Code | 14 |
| Input Example | 1,2,0,0,3,0 (Int) |
| Output Example | 3 (Int) |
| Level | 50 |
| Profit | $4,200 |
| Experience | 240 to each stat |
| Description | Given three points, return the area of the triangle. |
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); |
