codemaniacstudio

Write a Python program to enter base and height of a triangle and find its area.

Write a Python program to enter base and height of a triangle and find its area.

PROGRAM

# Python program to find the area of a triangle
# Input base and height from the user
base = float(input(“Enter the base of the triangle: “))
height = float(input(“Enter the height of the triangle: “))
# Calculate area
area = 0.5 * base * height
# Display the result
print(f”The area of the triangle is: {area} square units”)

OUTPUT

TRY THE ABOVE CODE

Exit mobile version