计算球体积
package com.test; import java.util.*; import java.io.*; public class Main { public static void main(String [] args) { Scanner sc=new Scanner(System.in); double d,r; String result; while(sc.hasNextDouble()) { r=sc.nextDouble(); d=(4.0/3)*3.1415927*Math.pow(r, 3); result= String.format("%.3f",d); System.out.println(result); } } }
posted on 2017-08-08 13:37 gavanwanggw 阅读(513) 评论(0) 编辑 收藏 举报