杭电oj —— 2002

/*
根据输入的半径值,计算球的体积
*/
#include<cstdio>
#include<cmath>
#define PI 3.1415927

int main(){
	//因为PI的精度太高了 float的精度按c语言里面的说法应该是保留7位,
	//但是一与别的相乘就会影响精度 
	double radius;
	double area;
	while(scanf("%lf",&radius) != EOF){
		getchar();
		area = (4.0/3) * PI * pow(radius,3);
		printf("%.3lf\n",area);		
	}
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/LiLi_code/article/details/87445087