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.
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):
1 2 3 4 5 6 7 8 |
b=int(input("Length : ")) h=int(input("Height : ")) area=0.5 * b * h print("Area of Triangle : ",area) |
Output:
Python Code(Perimeter):
1 2 3 4 5 6 7 8 |
a=int(input("Side 1 : ")) b=int(input("Side 2 : ")) c=int(input("Side 3 : ")) perimeter=a + b + c print("Perimeter of Triangle : ",perimeter) |
Output:
Source:
https://www.omnicalculator.com/math/triangle-area
https://www.omnicalculator.com/math/triangle-perimeter