CBSE Class 11 Computer Science
Question 45 of 48
Python Programming Fundamentals — Question 45
Back to all questions 45
Question Write a program to find the area of a triangle.
h = float(input("Enter height of the triangle: "))
b = float(input("Enter base of the triangle: "))
area = 0.5 * b * h
print("Area of triangle = ", area)Enter height of the triangle: 2.5
Enter base of the triangle: 5
Area of triangle = 6.25
h
=
float
(
input
(
"Enter height of the triangle: "
))
b
=
float
(
input
(
"Enter base of the triangle: "
))
area
=
0.5
*
b
*
h
print
(
"Area of triangle = "
,
area
)
Output
Enter height of the triangle: 2.5
Enter base of the triangle: 5
Area of triangle = 6.25