#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是错误的,4和3都是int型数据,所以4/3得1;将其改为4.0或3.0就行;
}
return 0;
}
【转】网上关于double型数据的输出用%f输入用%lf的解释的参考:http://blog.csdn.net/cldance/article/details/52050386