Problem Description
According to the radius value entered , Calculate the volume of the ball .
Input
There are multiple sets of input data , Each group has one line , Each row contains a real number , Represents the radius of the ball .
Output
Output the corresponding volume of the ball , For each group of input data , Output one line , The calculation results are kept to three decimal places .
Sample Input
1
1.5
Sample Output
4.189
14.137
Hint
define PI 3.1415927
Source
HDOJ
import java.text.DecimalFormat; import java.util.Scanner; public class Main {
public static void main(String[] args) { Scanner str = new Scanner(System.in);
DecimalFormat df =new DecimalFormat("0.000"); double x, y; while(str.hasNext())
{ x = str.nextDouble(); y = (4.0 * (3.1415927) * x * x * x) / 3; System.out
.println(df.format(y)); } str.close(); } }
Technology
Daily Recommendation