FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 92   



Following program shows you how to calculate circle area.
In this tutorial will get circle radius from user and calculate area and prints it using following formula
Area = PI X r X r

import java.util.Scanner;

public class MathGeometry8 {

    public static void main(String[] args) {

        double circleRadius;

        Scanner in = new Scanner(System.in);

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

        double areaOfCircle = Math.PI * (circleRadius * circleRadius);
        System.out.println("Area of circle is: " + areaOfCircle);

    }
}

Output:

Please enter the radius of circle:
3.2
Area of circle is: 32.169908772759484



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News