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.

Pramod Kumar Yadav is from Janakpur Dham, Nepal. He was born on December 23, 1994, and has one elder brother and two elder sisters. He completed his education at various schools and colleges in Nepal and completed a degree in Computer Science Engineering from MITS in Andhra Pradesh, India. Pramod has worked as the owner of RC Educational Foundation Pvt Ltd, a teacher, and an Educational Consultant, and is currently working as an Engineer and Digital Marketer.



Leave a Comment