首页 > 其他 > 详细

2002

时间:2016-03-27 15:19:17      阅读:117      评论:0      收藏:0      [点我收藏+]

计算球体体积

 1 #include <stdio.h>
 2 #define PI 3.14
 3 int main()
 4 {
 5     double r,v;
 6     while(scanf("%lf",&r))
 7     {
 8         v = (3.0/4)*PI*r*r*r;
 9         //除法最好留在最后算
10         printf(".3%lf\n",v);
11     }
12     return 0;
13 }

参考c++

 1 #include <math.h>
 2 #include <stdio.h>
 3 
 4 #define PI 3.1415927
 5 
 6 int main(void)
 7 {
 8     double r;
 9 
10     while (scanf("%lf", &r) != EOF)
11         printf("%.3lf\n", 4.0*PI*r*r*r/3.0);
12 
13     return 0;
14 }

 

2002

原文:http://www.cnblogs.com/ailx10/p/5325535.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!