The java program below uses * Math.PI* property of java that returns

*approx 3.14159*. The program takes the user input for the value of radius and calculates using the formula of Area and Circumference of a circle and displays the output accordingly.

**Java Program to Calculate the Area and Circumference of a Circle**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | //Area and circumference of circle import java.util.Scanner; public class AreaCircumCircle { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter the radius: "); double radius = sc.nextDouble(); //Area = PI*radius*radius double area = Math.PI * (radius * radius); System.out.println("The area of a circle is: " + area); //Circumference = 2*PI*radius double circumference= Math.PI * 2*radius; System.out.println( "The circumference of a circle is:"+circumference) ; } } |

**Output:**

`Enter the radius: 7 `

The area of a circle is: 153.93804002589985

The circumference of a circle is:43.982297150257104