Java program to calculate circle circumference

Views: 160   

Following program shows you how to calculate circle circumference.
In this program we get circle radius from user and calculate circumference using following formula
Circumference = 2 X PI X r

import java.util.Scanner;

public class MathGeometry9 {

    public static void main(String[] args) {

        double circleRadius;

        Scanner in = new Scanner(;

        System.out.println("Please enter the radius of circle:");
        circleRadius = in.nextDouble();

        double circumferenceOfCircle = 2 * Math.PI * circleRadius;
        System.out.println("Circumference of circle is: " + circumferenceOfCircle);



Please enter the radius of circle:
Circumference of circle is: 25.132741228718345
On By