Computer Science, asked by anchalshukla2721, 7 months ago

Write a program in Java to input the diameter of a circle find the area and circumference of the circle

Answers

Answered by saidulnayan781
2

Answer:

import java.util.Scanner;

class CircleDemo

{

  static Scanner sc = new Scanner(System.in);

  public static void main(String args[])

  {

     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