Java program to find the area of a circle


Area of a circle is the product of the square of its radius, and the value of PI, Therefore, to calculate the area of a rectangle

  • Get the radius of the circle.
  • Calculate the square of the radius.
  • Calculate the product of the value of PI and the value of the square of the radius.
  • Print the result.

Example

import java.util.Scanner;
public class AreaOfCircle {
   public static void main(String args[]){
      int radius;
      double area;
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the radius of the circle ::");
      radius = sc.nextInt();
      area = (radius*radius)*Math.PI;
      System.out.println("Area of the circle is ::"+area);
   }
}

Output

Enter the radius of the circle ::
55
Area of the circle is ::9503.317777109125

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 13-Mar-2020

14K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements