How to calculate the area of a circle in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        double radius = 5.7;
  
        double CircleArea = Math.PI * radius * radius;
  
        System.out.print("The area of the circle is: " + CircleArea);
    }
}
  
  
  
  
/*
run:
   
The area of the circle is: 102.07034531513239
   
*/

 



answered May 23, 2019 by avibootz
edited May 16, 2024 by avibootz

Related questions

...