# 题目
题解
输入数据有多组,因此使用while循环来输入输出数据,输出数据时使用.3f实现保留三位小数
代码实现
//HDU-2002
#include<iostream>
using namespace std;
#define PI 3.1415927
int main()
{
double r;
while (cin >> r)
{
printf("%.3f\n", 4 * PI*r*r*r / 3);
}
}
输入数据有多组,因此使用while循环来输入输出数据,输出数据时使用.3f实现保留三位小数
//HDU-2002
#include<iostream>
using namespace std;
#define PI 3.1415927
int main()
{
double r;
while (cin >> r)
{
printf("%.3f\n", 4 * PI*r*r*r / 3);
}
}