Monday, 4 August 2014

Java Code to find the Area of Circle

Area of a Circle Using Java

A Java program to accept the radius of a Circle from user and calculate the area.

//A small java program to calculate the area of a circle
import java.util.Scanner;

public class JavaCircleArea {

    public static void main(String args[])
      int radius;
      System.out.println("Enter the Radius of the Circle ");

      Scanner in = new Scanner(;
      radius = in.nextInt(); 

      double areaCircle = Math.PI*radius*radius;
      System.out.println("Area of the Circle = "+areaCircle);


Enter the Radius of the Circle 
Area of the Circle = 28.274333882308138

No comments :

Post a Comment