a fortran example

program volume_area
   real :: r,h,v,s,pi
   pi=3.1415926
   print *,'input radius r and height h?'
   read *,r,h
   v=r*r*h/3*pi
   s=pi*r*sqrt(r**2+h**2)+pi*r**2
   print *,'volume=',v
   print *,'area =',s

end

 

 

mikeli@mikeli-Latitude-E6440:~/code$ ./e_121_02
 input radius r and height h?
3.0 5.2
 volume=   49.0088425    
 area =   84.8544083

posted @ 2021-10-03 19:57  MikeLi  阅读(28)  评论(0编辑  收藏  举报