write a program to calculate the area of triangle where a user will input the length of the base of the triangle and it's height.(area of triangle 1/2 *base *height)
Answers
Explanation:
# Python Program to find Area of a Triangle using base and height
base = float(input('Please Enter the Base of a Triangle: '))
height = float(input('Please Enter the Height of a Triangle: '))
# calculate the area
area = (base * height) / 2
print("The Area of a Triangle using", base, "and", height, " = ", area)
Answer:
Python: Area of a triangle
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. A triangle with vertices A, B, and C is denoted triangle ABC.
Vertex of a triangle: The point at which two sides of a triangle meet.
Altitude of a triangle: The perpendicular segment from a vertex of a triangle to the line containing the opposite side.
Base of a triangle: The side of a triangle to which an altitude is drawn.
Height of a triangle: The length of an altitude.
Python: Area of a triangle
Sample Solution:-
Python Code:
b = int(input("Input the base : "))
h = int(input("Input the height : "))
area = b*h/2
print("area = ", area)
Sample Output:
Input the base : 20
Input the height : 40
area = 400.0
Explanation:
Hope it helps you