Java Program to Calculate Area of Circle

In this article, we are going to write a java program to calculate the area of a circle. We will use the java Scanner class for taking radius input from the User

Area of Circle

We can calculate area of circle by using following formula

Area = pi * r*r

Here pi = 3.14 , r is radius of circle

Java Program to Calculate Area of Circle

Steps to Calculate Area of Circle using Programming Language

  • Take radius input from user
  • Calculate Area of circle by using formula pi*r*r
  • Print the Area of Circle

Java Code for Area of Circle

package gangforcode;

import java.util.Scanner;
public class AreaofCircle {

    public static void main(String[] args) {
        final double pi = 3.14;
        Scanner sc = new Scanner(;
        System.out.println("Enter the radius of Circle");
        double radius = sc.nextDouble();
        double area = pi*radius*radius;
        System.out.println("Area of Circle = " +area);

Output for java code:-

area of circle

You can calculate the area of a circle in the same way in other programming languages like C, C++ Python, etc

Similar Java Programs Tutorial

Matrix Addition in Java –
Binary Search in Java –
first non repeating character –
Armstrong number in java –
All Armstrong Numbers –

4 thoughts on “Java Program to Calculate Area of Circle”

Leave a Comment