相关代码 |
|
//lx3_7.java import java.io.*; public class lx3_7{ public static void main(String args[ ]) { double PI=3.141592654D; //定义常量 double r=0, area; String S=""; System.out.println ( "圆的半径为:"); try{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); S=in.readLine(); r= Double.parseDouble (S); } catch(Exception e){} area = PI * r * r; System.out.println ("面积为:"+area); } }
相关资源 |
|