Computer Science, asked by StudiousStudent8661, 11 months ago

To accept radius of a circle and print its area and circumference using classes

Answers

Answered by anindyaadhikari13
21

Here is your answer.

import java.util.Scanner;

class Circle

{

public static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter the radius: ");

double radius = sc.nextDouble();

double area = Math.PI * (radius * radius);

System.out.println("The area of circle is: " + area);

double circumference= Math.PI * 2*radius;

System.out.println( "The circumference of the circle is:"+circumference) ;

}

}

Similar questions