Find the Area of a Circle – Java Program

Area of a circle = πR2

Where π = 3.14 and R = radius of circle
Area Of Circle
Example:

Radius = 4.0
Area = π*radius*radius = 3.14*4*4 = 50.24

Code:

public class AreaOfCircle {
public static void area(double radius){
double pi = 3.14;
double area = pi*radius*radius;
System.out.println("Area of circle with radius="+radius + " is: " + area);
}
public static void main(String[] args) {
double radius = 4;
area(radius);
}
}

view raw
AreaOfCircle.java
hosted with ❤ by GitHub

Output:

Area of circle with radius=4.0 is: 50.24