A Program to Find the Area of a Triangle
In this example, we are giving a program to find the area of a triangle. The rule of finding the area of a triangle is: A = 0.5 * base * height.
Program to find the area of a triangle:
b = float(input("Enter the value of base: "))
h = float(input("Enter the value of height: "))
area = 0.5 * b * h;
print("Area of triangle: %.2f"%area)
Output:
Enter the value of base: 3 Enter the value of height: 4 Area of triangle: 6.00