#include<stdio.h>
#define PI 3.1415927
int main(){
double r;
while(scanf("%lf",&r)!=EOF){
printf("%.3f\n",4*PI*r*r*r/3); //4/3*PI*r*r*r是錯(cuò)誤的代态,4和3都是int型數(shù)據(jù),所以4/3得1;將其改為4.0或3.0就行效诅;
}
return 0;
}
【轉(zhuǎn)】網(wǎng)上關(guān)于double型數(shù)據(jù)的輸出用%f輸入用%lf的解釋的參考:http://blog.csdn.net/cldance/article/details/52050386