Problem2 : Calculate Circle Area and Circumference

 Problem2 : Calculate Circle Area and Circumference

Write a program to calculate and print Area and Circumference of a circle. Assume Radius to be an integer and initialized it with any value of your choice.

public class Circle {
public static void main(String [] args)
{
int radius = 35;
double Area = Math.PI * Math.pow(radius,2);
System.out.println("Area of circle is "+Area);
double Circumference = 2 * Math.PI * radius;
System.out.println("Circumference of circle is "+Circumference);
}
}

Output:

Area of circle is 3848.4510006474966
Circumference of circle is 219.9114857512855

Comments

Popular posts from this blog

Day2 : Compiling Java Program with Examples

Day1: Introduction to Java and its feature

What does System.out.printf( "%-15s%03d\n", s1, x) do?