Compute the Area of a Circle in Java

This is a Java Program to calculate and display Area of a Circle. 
Formula:
Perimeter of circle = pi * radius * radius
public class Area {
  public static void main(String args[]) {
    double pi, r, a; 

    r = 10.8; // radius of circle
    pi = 3.1416; // pi, approximately
    a = pi * r * r; // compute area

    System.out.println("Area of circle is " + a);
  }
}
Output:
Area of circle is 366.436224


Comments