Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
411 views
in Computer by (51.9k points)
closed by

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

1 Answer

+1 vote
by (49.6k points)
selected by
 
Best answer

The diagram can be drawn as follows:

To calculate the sin() value in Python, math module sin() function is needed. The values need to be passed in radians to the sin() function. Therefore, the degree will be converted to radians and then the sin() function will be applied.

Program:

#import the math module, to use sin & 

radians function

import math

length = int(input("Enter the length of the ladder: "))

degrees = int(input("Enter the alignment degree: "))

#Converting degrees to radian

radian = math.radians(degrees)

#Computing sin value

sin = math.sin(radian)

# Calculating height and rounding it off to 2 decimal places

height = round(length * sin,2)

#displaying the output

print("The height reached by ladder with length",length,"feet and aligned

at",degrees,"degrees is",height, "feet.")

OUTPUT:

a) Enter the length of the ladder: 16

Enter the alignment degree: 75

The height reached by the ladder with length 16 feet aligned at 75 degrees is 15.45 feet.

b) Enter the length of the ladder: 20

Enter the alignment degree: 0

The height reached by the ladder with length 20 feet and aligned at 0 degrees is 0.0 feet.

c) Enter the length of the ladder: 24

Enter the alignment degree: 45

The height reached by the ladder with length 24 feet and aligned at 45 degrees is 16.97 feet.

d) Enter the length of the ladder: 24

Enter the alignment degree: 80

The height reached by the ladder with length 24 feet and aligned at 80 degrees is 23.64 feet.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...