![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMtnRs9aW5lMMlb5kHUx8VN69GfGKk6J4XJAa3A0DiNW1KW8HJ5uRtcTpALc0agEq63UFYKWAahcldJrJJ-QbfKfG5QFb-Oame4jRMzAQZks709TnlX9xN2Irx8eHbLNmVKP8Oa14laQk/s2048/PicsArt_07-05-12.04.26.jpg)
volume of sphere and hemisphere.
- Volume of hemisphere = 2Ï€r3/3, where 'r' is the radius of the hemisphere.
- Volume of sphere = 4Ï€r3/3, where 'r' is the radius of the sphere.
Program to find volume of sphere and hemisphere
Input :
enter radius of sphere 4
enter radius of hemisphere 4
Output :
volume of sphere is %.2f 268.08
volume of hemisphere is 134.04
# Program to find volume of sphere and hemisphere
# for pi use pi value as 3.1423 or import math module
from math import*
#Program to find volume of sphere
radius1 = float(input("enter radius of sphere "))
vol_sphere = (4*pi*radius1*radius1*radius1)/3
print("volume of sphere is %.2f",round(vol_sphere,2))
#Program to find volume of hemisphere
radius2 = float(input("enter radius of hemisphere "))
vol_hemisphere = (2*pi*radius2*radius2*radius2)/3
print("volume of hemisphere is ",round(vol_hemisphere,2))
#here round(var,n) is predefined function used to get n digits after point
Output :
enter radius of sphere 4
volume of sphere is %.2f 268.08
enter radius of hemisphere 4
volume of hemisphere is 134.04
>
Comments
Post a Comment
Type Your Comments !
Please do not enter any spam link in the comment box.