write a java program to input the radius of a circle calculate the area and perimeter of the circle and print them
Answers
Answer:
import java.util.Scanner;
public class calculate
{
public static void main(String[] args)
{
Scanner sc= new Scanner (System.in) ;
System.out.println("Enter the radius of the circle: ") ;
double radius= sc. nextDouble();
double circumference=2*Math.PI*radius;
double area= Math. PI*radius*radius;
System.out.println("The circle with radius"+radius+" has an area of : "+area) ;
System.out.println("The circle with radius"+radius+" has a circumference of : "+circumference) ;
}
}
Answer:
Explanation:import java.util.Scanner;
public class circle {
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("enter Radius:");
double radius=input.nextDouble();
System.out.println("perimeter="+ (2 * Math.PI * radius) );
System.out.println("area=" + (Math.PI * radius * radius));
}
}