Java Program to Calculate Area of a Circle

Java Program to Calculate Area of a Circle

//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
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment