The area of the circle is defined as A = π . R2, having π as 3.14159.
Calculate the area using the formula given in the problem description.
Input: Read the variable R (double precision), that is the radius of the circle.
Output: Print the variable A, rounded to four decimal digits.
Sample Input : 2
Sample Output: A=12.5664
i have tried this ,
import java.util.Scanner;
public class Area {
public static void main(String a[])
{
Double R,A;
Scanner in=new Scanner(System.in);
R=in.nextDouble();
A=3.14159*R*R;
System.out.println("A="+(Math.round(A*1000.0)/10000.0));
}
}