根据输入的半径值,计算球的体积。

思路:用pow函数,定义pi

#include <stdio.h>
#include <stdlib.h>
#include"math.h"
#define PI 3.1415927

int main()
{
double r,c;
while(scanf("%lf",&r)!=EOF)
{
c=pow(r,3);
c=4*PI*c/3;
printf("%.3lf\n",c);
}

return 0;
}

posted on 2019-01-26 10:32  zhs的小迷弟  阅读(2801)  评论(0编辑  收藏  举报

导航