A Java program that will find the Area and Circumference of a circle
- Nelson John
- Nov 22, 2017
- 1 min read

import java.util.Scanner;
class CircleDemo
{
static Scanner sc = new Scanner(System.in);
public static void main(String args[])
{
System.out.print("Enter the radius: ");
/*We are storing the entered radius in double
* because a user can enter radius in decimals
*/
double radius = sc.nextDouble();
//Area = PI*radius*radius
double area = Math.PI * (radius * radius);
System.out.println("The area of circle is: " + area);
//Circumference = 2*PI*radius
double circumference= Math.PI * 2*radius;
The output should look like this
Enter the radius: 1
The area of circle is: 3.141592653589793
The circumference of the circle is: 6.283185307179586
Facebook: ayamnelrodinho1@gmail.com
Yahoo: talk2nelsonjohn2dat@yahoo.com
Whatsapp: +2349034595610
PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOG FOR MORE FEEDS.
Comments