Area Of Equilateral Triangle In Python
This is how an equilateral triangle looks like:
As you can see, this is an equilateral triangle with a side length of “a” units and a height of “h” units.
The altitude of an equilateral triangle cuts the opposite side at right angles. So, by using the Pythagoras theorem, we can calculate the height of an equilateral triangle to be sqrt(3/4)a.
Thus, the area of an equilateral triangle = 1/2 * sqrt (3/4)a * a
Area = (sqrt 3)/4 * a^2
Program:
No comments:
Post a Comment