杭电ACM2002计算求得体积

 1 import java.text.DecimalFormat;
2 import java.util.Scanner;
3 public class Main{
4 public static final double PI = 3.1415927;
5 public static void main(String[] args) {
6 Scanner scan = new Scanner(System.in);
7 double radius = 0;
8 double volume = 0.000;
9 DecimalFormat myformat = new DecimalFormat("#####0.000");
10 while(scan.hasNext()){
11 radius=scan.nextDouble();
12 volume = 4*PI*radius*radius*radius/3;
13 System.out.println(myformat.format(volume));
14 }
15 }
16 }
原文地址:https://www.cnblogs.com/bchxsx322/p/2429905.html