Q:

Java program to Calculate Area of a Circle

0

Java program to Calculate Area of a Circle

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Area of Circle using Java Program

//Java program to Calculate Area of a Circle.

import java.util.Scanner;

public class AreaCircle {

  public static void main(String[] args) {

    double radius;
    Scanner sc = new Scanner(System.in);

    // input radius of circle
    System.out.print("Enter the Radius of Circle : ");
    radius = sc.nextDouble();

    // circle area is pie * radius square
    double area = 3.14 * radius * radius;

    System.out.print("Area of Circle : " + area);

  }

}

Output:

    
    Enter the Radius of Circle : 12.5
    Area of Circle : 490.625

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Core Java Example programs for Beginners and Professionals

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to Calculate Perimeter of a Circle... >>
<< Java program to find Area of Rectangle...