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 calculate circumference of circle in java, first we have to get radius of circle from user then find the product using below formula and finally print the result.

Also read – java program to calculate area of circle using methods

To find circumference of a circle formula is,

circumference = 2πr

Here’s the java program to calculate circumference of circle,

import java.util.Scanner;

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


Also read – java program to find area of rectangle

Also read – java program to find area of circle

Also read – java program to find area of circle using class and object