Area of a Circle Using Java
A Java program to accept the radius of a Circle from user and calculate the area.
import java.util.Scanner;
public class JavaCircleArea {
public static void main(String args[])
{
int radius;
System.out.println("Enter the Radius of the Circle ");
Scanner in = new Scanner(System.in);
radius = in.nextInt();
double areaCircle = Math.PI*radius*radius;
System.out.println("Area of the Circle = "+areaCircle);
}
}
Output:
Enter the Radius of the Circle
3
Area of the Circle = 28.274333882308138