Java program to find the circumference of a circle


The circumference of a circle is double the product of its radius and the value of PI. Therefore, to calculate the circumference of a circle

  • Get the radius of the circle form the user.
  • Calculate the product
  • Print the final result.

Example: Finding the circumference of a circle

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

Output

Enter the radius of the circle::
55
The circumference of the circle is::345.57519189487726

Updated on: 24-Jun-2024

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements