Area and Perimeter of a Circle using Buffered Reader
import java.io.*;
import java.lang.*; class circles { public static void main(String args[]) { try { int r; double area,peri; BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the radius:"); r=Integer.parseInt(b.readLine()); area=java.lang.Math.PI*r*r; System.out.println("area of a circle:"+area); peri=2*java.lang.Math.PI*r; System.out.println("perimeter of a circle:"+peri); } catch(IOException e) { System.out.println("error"); } } } |
0 comments:
Post a Comment