Prime #### Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime #### Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

# Java Program for calculating the Area of a circle

## Area of a circle using Java :

The area of a circle is the number of square units inside the circle. If we know the radius of the circle, then we can directly calculate the area by using a standard formula,

where, A is the Area enclosed by a circle,

π is a constant with value 3.14, and

r is the radius of the circle.

In this article, we will create a java program to calculate the area of a circle, where radius is asked to be entered by the user. ## Working:-

Step 1 : Ask the user to enter the radius of a circle.

Step 2 : Calculate the area of a circle by using the standard formula:

Step 3 : Print the result.

## Java Code:-

```//Java program to calculate area of a circle
import java.util.Scanner;
public class area_of_circle
{
public static void main(String[] args)
{
//scanner class declaration
Scanner sc = new Scanner(System.in);

//input from the user
System.out.print("Enter the radius of a circle : ");

//formula for area of a circle
```Output: