Tuesday, 13 December 2016

Java Program To Find Area And Circumference Of Circle

Circumference :-Circumference of circle is the distance around the circle. Calculate The Circumference of Circle By Given Formula

Circumference = 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   =π *r*r

For more about Area Of Circle Click Here 

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

Solution :-

/* 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:-

Java Program To Find Area And Circumference Of Circle

No comments:
Write comments

Recommended Posts × +