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

Also read – area of circle java

Java program to find circumference of a circle

Here’s the java program to calculate circumference of a circle where user enters radius,

To calculate circumference of 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