Java Program to calculate area and circumference of circle

  • Given radius of a cirle, write a java Program to find the area and circumference if a circle.

Given the radius of a circle, circumference and area of circle, can be calculated using below mentioned formula. First of all, we will take the radius of circle as input form user and then print the area and circumference of circle on screen.

  • Circumference of Circle = 2 x PI x Radius
  • Area of Circle = PI X Radius X Radius

Java program to calculate calculate and area of circle

package com.tcc.java.programs;

import java.util.*;

public class CircleArea {

    public static void main(String[] args) {
 double radius, area, circumference;
 Scanner in = new Scanner(System.in);
 System.out.println("Enter Radius of Circle:");
 radius = in.nextDouble();
 // Calculate area and circumference of circle
 area = Math.PI * radius * radius;
 circumference = 2 * Math.PI * radius;

 System.out.println("Area of Circle : " + area);
 System.out.println("Circumference of Circle : " + circumference);
    }

}
Output
Enter Radius of Circle:
3
Area of Circle : 28.274333882308138
Circumference of Circle : 18.84955592153876

Recommended Posts
Java Program to Find Area of Right Angled Triangle
Java Program to Find Area Of Triangle
Java Program to Find Area Of Trapezoid
Java Program to find Area Of Equilateral Triangle
Java Program to Calculate Volume of Sphere
Java Program to Find Surface Area and Volume of Cylinder
Java Program to Calculate Surface Area and Volume of Cube
Java Program to Find Volume and Surface Area of Cuboid
Java Program to Calculate Volume and Surface Area of Cone
Java Program to Find Area and Perimeter of Rectangle
Java Program to Convert Celsius to Fahrenheit
All Java Programs