Java Program to find area of circle of input radius

In geometry, the area is enclosed by a circle of radius r is π*r*r.Here value of π represents a constant and approximately equal to 3.14159,which is equal to the ratio of the circumference of any circle to its diameter.

import java.util.Scanner;
class scan
{
 public static void main(String arg[])
  {
 double r,x,pie=3.14;
   Scanner kb=new Scanner(System.in);
   System.out.println("Enter radius:- ");
    r=kb.nextInt();
    x=pie*r*r;
   System.out.println("Area of Circle = "+x);
 
   }
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *