Python

Python Program to Calculate Area and Perimeter of Triangle1 min read

To find the area of a triangle you need to multiply the length and the height/altitude of a triangle. There are different units for perimeter and area. 

Program to Calculate Area and Perimeter of Triangle

Program to Calculate Area and Perimeter of Triangle

A triangle is one of the most basic shapes in geometry. The best known and the simplest formula, which almost everybody remembers from school is: area = 0.5 * b * h, where b is the length of the base of the triangle, and h is the height/altitude of the triangle.




The basic formula is really uncomplicated. Just add up the lengths of all of the triangle sides and you obtain the perimeter value: perimeter = a + b + c

In this example. I’ll show how to calculate Area and Perimeter of Rectangle in Python.

Python Code(Area):

Output:

Program to Calculate Area of Triangle

Program to Calculate Area of Triangle

Python Code(Perimeter):

Output:

Program to Calculate Perimeter of Triangle

Program to Calculate Perimeter of Triangle

Source:

https://www.omnicalculator.com/math/triangle-area

https://www.omnicalculator.com/math/triangle-perimeter

Leave a Comment