To calculate Area of Circle in java program

Java Program to Calculate the Area of Circle

In this program, we will learn to calculate and display the area of a circle. To calculate the area of the circle we have to use a formula that is: (22*r*r)/7. Here “r” means the radius of the circle.

Algorithm to Calculate the area of the circle

  1. import java.io.*;
  2. import java.util.*;
  3. create class Area
  4. public static void main(String[] args)
  5. Scanner ob = new scanner (System.in)’
  6. double r;
  7. System.out.print(“Enter radius”);
  8. r = ob.nextInt();
  9. double area = (22*r*r)/7.
  10. System.out.print(” Area of the Circle is: ” + area);

Source Code to Print the area of Circle

import java.io.*;
import java.util.*;
class Area
{
public static void main(String []args)
{
Scanner ob=new Scanner(System.in);
double r;
System.out.println(“enter value r”);
r=ob.nextInt();
double c = (22*r*r)/7;
System.out.println(“area of circle: ” +c);
}
}

Execute Code Here

Recommended Post:

Find the solution to the salesforce Question.

Hi, I’m Pramod Kumar Yadav & a computer science Engineer with 3years of experience in Digital marketing. I’m self-motivated and love to do SEO.

Leave a Reply

%d bloggers like this: