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

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.