0% found this document useful (0 votes)
118 views

Java Program To Calculate Area and Circumference of Circle

This document provides a Java program to calculate the area and circumference of a circle. It explains that the circumference of a circle is calculated using the formula 2 * π * r and the area is calculated using the formula π * r * r, where π is approximately 3.141592653589793 and r is the radius. The Java program then prompts the user to input the radius, calculates the area and circumference using the radius and Math.PI constant, and prints out the results.

Uploaded by

A- S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

Java Program To Calculate Area and Circumference of Circle

This document provides a Java program to calculate the area and circumference of a circle. It explains that the circumference of a circle is calculated using the formula 2 * π * r and the area is calculated using the formula π * r * r, where π is approximately 3.141592653589793 and r is the radius. The Java program then prompts the user to input the radius, calculates the area and circumference using the radius and Math.PI constant, and prints out the results.

Uploaded by

A- S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Java Program to Calculate Area and Circumference of Circle

Problem:- Java Program to Calculate Area and Circumference


of Circle or Program to Calculate Area and Circumference of
Circle in Java or simple java program to find area of circle or
Java Program to Calculate and Display Area of a Circle or
Java Program to calculate area and circumference of circle or
Calculate Area / Circumference Of Circle Using Java Math.PI

Check This:- HackerRank solution for C++ Domain.

Explanation:- Circumference of the circle is the distance


around the circle. Below two formula are given with the help
of both formulae you can find the Area and Circumference of
Circle. We can calculate the circumference of the circle by
given formula.

Circumference of Circle = 2 * π * r

Here PI (π) is a Greek Letter and r is a Radius (1/2 Of


Diameter ) PI (π) = 3.141592653589793 Approx. It is a
constant value for more about Circumference Click Here

Area of Circle = π * r * r

For more about area of Circle Click Here

See Also:- C Program To Find Area And Circumference Of


Circle
Java Program to Calculate Area and Circumference of Circle
/* Program By Ghanendra Yadav

Visit http://www.programmingwithbasics.com/

*/

import java.util.Scanner;

class circle

static Scanner sc = new Scanner(System.in);

public static void main(String args[])

System.out.print("Enter The Radius Of Circle: ");

double radius = sc.nextDouble();

double area = Math.PI * (radius * radius);

System.out.println("Circle Area is : " + area);

double circumference= Math.PI * 2*radius;

System.out.println( "Circle Circumference


is:"+circumference);

See Also:-C++ Program To Find Area And Circumference Of


Circle
Output:-

You might also like