90.6k views
4 votes
Write an algorithm to find the area of a triangle

1 Answer

4 votes

Using base and height (Heron's formula)

This algorithm works for any triangle when you know the base length and the corresponding height.

Input:

Base length of the triangle (b)

Height of the triangle (h)

Calculate the area:

Area = (1/2) * b * h

Output:

The area of the triangle

User Bruno Villanova
by
8.9k points