AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.

# corejava-programming: Find area of a circle

 Arjit wants to create a wall bisecting a circular ground. Write a program which takes the area of the ground in sq. units as input and gives the length of the wall(diameter) as the output. Find the diameter of the circle for any given area till 4 decimal places. Sample Input: 50.23 Sample Output: 7.9992 Hint: To find square root use Math.sqrt() and 3.14 as value of Pi. For rounding it upto 4 decimal places make use of DecimalFormat class of java.text package. Sample double d=123.456546; DecimalFormat f=new DecimalFormat("##.####"); System.out.println(f.format(d)); corejava x 353programming x 168 Posted On : 2016-10-02 12:16:37.0 Aarti Kumar 5900 5

 Check this code and let me know if conditions are satisfied or not. import java.text.DecimalFormat; import java.util.Scanner; class AreaOfCircle { public static void main(String args[]) { DecimalFormat f=new DecimalFormat("##.####"); Scanner s=new Scanner(System.in); double r=s.nextDouble(); double pi=3.14; double dm=2*Math.sqrt(r/3.14); System.out.println(f.format(dm)); } } Posted On : 2016-10-03 10:40:58 Satisfied : 2 Yes  0 No 5