Java program to find circumference of a circle

In this post we are going to learn java program to find circumference of a circle.

java program to find circumference of a circle

Java program to find circumference of a circle

To find the circumference of a circle, first we have to get radius of circle from user then find the product using below formula and finally print the result.

Also read – area of circle in java

To find the circumference of a circle formula is,

circumference = 2πr

public class CircumferenceOfCircleJava 
{
   public static void main(String[] args) 
   {
      int radius;
      double circumference;
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the radius : ");
      radius = sc.nextInt();
      circumference = Math.PI * 2 * radius;
      System.out.println("Circumference of circle : " + circumference);
      sc.close();
   }
}

Output:

Enter the radius : 10
Circumference of circle : 62.83185307179586