C Program to find the volume and total surface area of a cone
write(*,*)'Enter the radius:'
read(*,*)r
write(*,*)'Enter the height:'
read(*,*)h
a=acos(-1.0)*r*(r+sqrt(r*r+h*h))
v=((acos(-1.0)*r*r*h)/3.0)
write(*,10)a
write(*,20)v
10 format(2x,'The total surface area of the cone is',f16.4)
20 format(2x,'The volume of the cone is',f16.4)
end
write(*,*)'Enter the radius:'
read(*,*)r
write(*,*)'Enter the height:'
read(*,*)h
a=acos(-1.0)*r*(r+sqrt(r*r+h*h))
v=((acos(-1.0)*r*r*h)/3.0)
write(*,10)a
write(*,20)v
10 format(2x,'The total surface area of the cone is',f16.4)
20 format(2x,'The volume of the cone is',f16.4)
end
Comments
Post a Comment