Java program to find circumference of a circle

Let’s 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 circumference of 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 – how to rename file in java

To find circumference of a circle formula is,

circumference = 2πr

Here’s the java example program to find circumference of circle,

// circle java
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();
      // double radius
      circumference = Math.PI * 2 * radius;
      System.out.println("Circumference of circle : " + circumference);
      sc.close();
   }
}



Output:

Enter the radius : 10
Circumference of circle : 62.83185307179586