Java program to print the area and perimeter of a circle. - BSC IT PRACTICALS

Monday, January 15, 2018

Java program to print the area and perimeter of a circle.


CODE:

import java.util.*;
import java.lang.Math.*;
class prac1C
{
public static void main(String args[])
{
double r,perimeter,Area;
Scanner ob=new Scanner(System.in);
System.out.print("Enter the Radius of Circle: ");
r=ob.nextDouble();
perimeter =2*Math.PI*r;
Area=Math.PI*r*r;
System.out.println("Perimeter of Circle is: "+perimeter);
System.out.println("Area of Circle is: "+Area);
}

}

No comments:

Post a Comment