Q. Presume that a ladder is put upright against a wall. Let variables length and angle store the length of the ladder and the angle that it forms with the ground as it leans against the wall.  Write a Python program to compute the height reached by the ladder on the wall for the following values of length and angle:

(a) 16 feet and 75 degrees

(b) 20 feet and 0 degrees

(c) 24 feet and 45 degrees

(d) 24 feet and 80 degrees


Answer:-


import math
length = float(input("Enter the length of ladder:- "))
angle = float (input("Enter the Angle form:- "))
height = length * math.sin(math.radians(angle))
print ("The height reached by the ladder on the wall:-", height," Feet")


Output:-

(a)
Enter the length of ladder:- 16
Enter the Angle form:- 75
The height reached by the ladder on the wall:- 15.454813220625093  Feet
>>>

(b)
Enter the length of ladder:- 20
Enter the Angle form:- 0
The height reached by the ladder on the wall:- 0.0  Feet
>>>

(c)
Enter the length of ladder:- 24
Enter the Angle form:- 45
The height reached by the ladder on the wall:- 16.97056274847714  Feet
>>>

(d)
Enter the length of ladder:- 24
Enter the Angle form:- 80
The height reached by the ladder on the wall:- 23.63538607229299  Feet
>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post