Q. Write a program that calculates the volume and surface area of a sphere. The program must first ask the user to key in a radius value, r, before it performs the calculations. The program should display the result of the calculations. Save the program as "sphere.py".
Use the following formulae:
Surface area, S = 4 π r2
Volume, V = 4 / 3(Ï€ r3)
Ï€ = 3.142
Answer =
First make a module name with "sphere.py". Then write the program.
r = float (input ("Enter the Radius of sphere :- ")) print ("Surface Area :- ", 4 * 3.142 * r ** 2) print ("Volume :- ", 4 / 3 * (3.142 * r ** 3))
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )