Java - Print the area of a circle

Description

Print the area of a circle

Demo

import java.util.Scanner;
public class Circle
{
    public static void main(String[] args)
    {/*w w  w.java 2  s  . c om*/
        Scanner scan = new Scanner (System.in);
        final double PI = 3.14159;
        int radius;
        System.out.println("Please enter a value for the radius of a circle");
        radius = scan.nextInt();
        double area = PI * radius * radius;
        double circumf = 2 * PI * radius;
        System.out.println("The area of a circle with radius " + radius + " is " 
                            + area);
        System.out.println("The circumference of a circle with radius " +
                radius + " is " + circumf);

    }
}

Related Topic