Skip to content
Home » Python program to calculate area of a triangle

Python program to calculate area of a triangle

area of a triangle=0.5(base)(height)

Below is the program to calculate area of a triangle

# to calculate area of a triangle
b=float(input("Enter base of the triangle:"))
h=float(input("Enter height of the triangle:"))
area=0.5*b*h
print("Area of triangle:",area)

Output:

Enter base of the triangle:4
Enter height of the triangle:7
Area of triangle: 14.0