Apr 2, 2021

Write a java program to find area of circle

 EX: Write a java program to find area of circle. How to write a java program to find area of circle. Java program to find area of circle.

Program:

import java.util.Scanner;

public class AreaofCircle {


    public static void main(String[] args) {

        int radius;
        double area;

        Scanner sc = new Scanner(System.in); 

        System.out.println("Enter the radius : ");
        radius = sc.nextInt();

        area = 3.14*radius*radius;//here, 3.14 is a value of pi...
        System.out.println("Area of circle is : " +area);
        
    }
}
Above java program shows the following output:

Enter the radius: 55
Area of circle is : 9498.5 

Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...