Page 624 - ComputerScience_Class_11
P. 624
The output of the preceding program is as follows:
Output
Enter the principal: 10000
Enter rate of interest: 10
Enter time duration in years: 5
Simple Interest: 5000.0
30. Write a program to convert currency from dollars to Indian rupees.
Program 30.py
File Edit Format Run Options Window Help
usd_amount = float(input("Enter amount in USD: $"))
conversion_rate = 91.42
inr_amount = usd_amount * conversion_rate
print(usd_amount, "USD is equivalent to ", inr_amount, "INR.")
The output of the preceding program is as follows:
Output
Enter amount in USD: $100
100.0 USD is equivalent to 9142.0 INR.
31. Write a program to calculate the area of a cylinder using Python’s math package.
Program 31.py
File Edit Format Run Options Window Help
import math
radius = float(input("Enter the radius of the cylinder (in units): "))
height = float(input("Enter the height of the cylinder (in units): "))
lateral_surface_area = 2 * math.pi * radius * height
total_surface_area = 2 * math.pi * radius * (radius + height)
print("The Lateral Surface Area of the cylinder is: ", round(lateral_surface_area,
2), " square units.")
print("The Total Surface Area of the cylinder is: ", round(total_surface_area, 2),
" square units.")
The output of the preceding program is as follows:
Output
Enter the radius of the cylinder (in units): 10
Enter the height of the cylinder (in units): 20
The Lateral Surface Area of the cylinder is: 1256.64 square units.
The Total Surface Area of the cylinder is: 1884.96 square units.
622 Touchpad Computer Science (Ver. 3.0)-XI

