杭电ACM--2002计算求得体积

 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 }

 

posted @ 2012-04-02 14:31  编程小神仙  阅读(244)  评论(0编辑  收藏  举报