Java代码参考

yukikage 发表于 6个月前 · 关联问题 球的体积和表面积

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double r,v,s; double pi=3.14159; r=sc.nextDouble(); v=4.0/3.0*pi*r*r*r; s=4*pi*r*r; System.out.printf("%.6f\n%.6f",v,s); } }