Q:

Write a Java program to print the area and perimeter of a circle

0

Write a Java program to print the area and perimeter of a circle
Test Data:
Radius = 7.5
Expected Output
Perimeter is = 47.12388980384689
Area is = 176.71458676442586

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

public class Exercise11 {
 
   private static final double radius = 7.5;

    public static void main(String[] args) {

        double perimeter = 2 * Math.PI * radius;
        double area = Math.PI * radius * radius;

        System.out.println("Perimeter is = " + perimeter);
        System.out.println("Area is = " + area);
    }
}

Sample Output:

Perimeter is = 47.12388980384689                                                                              
Area is = 176.7145867644258

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now