area of circle
//area of circle
class area
{
public static void main(String[] args) {
//enter a number
try{
double j=new java.util.Scanner(System.in).nextDouble();
System.out.println("Calculation involving circle\n"+"Enter a number as radius:"+" "+j+"\n");
System.out.printf("%s %f \n\n","The diameter:",2*j);
System.out.printf("%s %f %n %n","The circumference:",2*Math.PI*j);
System.out.printf("%s %f","The area of circle:",Math.PI*j*j);}
catch (java.util.InputMismatchException e){
System.out.print("Enter a number");
}
catch (Exception e){
System.out.print("Please enter a number");
}
}}
Comments
Post a Comment