This Python program reads the base and height of a triangle from the user and calculates its area.
The formula used is:
Area = (base × height) / 2
# Read inputs from user
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))
# Calculate area
area = (base * height) / 2
# Display result
print("\n--- Result ---")
print(f"The area of the triangle is: {area:.2f}")
Enter the base of the triangle: 10
Enter the height of the triangle: 5
--- Result ---
The area of the triangle is: 25.00
- Inputs are received as floating-point numbers
- The standard formula for triangle area is applied
- The result is printed with two decimal places