Mini Project - Heron's Formula

Applying Swift to trignometry

Back to geometry...

Heron’s formula is a formula that is used to find the area of any triangle. All you need is the lengths of all 3 sides.

The formula is Area = √s x (s-a) x (s-b) x (s-c) where s is (a+b+c)/2 and a,b, and c are the side lengths.


Using this formula, write a function that solves for the area of a triangle, given 3 side lengths. Then, try it out on a couple of triangles.

Triangle 1 with sides 10, 12, and 15. Triangle 2 with sides 12, 14, 7.

Good Luck!