In this Program, we are going to share Java program to calculate area of a circle. If you are a Java beginner and want to start learning the Java programming, then keep your close attention in this tutorial as I am going to share how to write a Java program to calculate an area of a circle.
Java program to calculate area of a circle
Copy the below Java program and execute it with the help of Javac compiler. At the end of this program, We have shared the output of this program.
import java.util.Scanner; public class AreaCircle { public static void main(String[] args) { double radius; Scanner sc=new Scanner(System.in); // enter the radius of any circle System.out.print("Enter the Radius of Circle : "); radius=sc.nextDouble(); double area=3.14*radius*radius; System.out.print("Area of Circle : "+area); } }
Program Output
Enter the Radius of Circle : 10.5
Area of Circle : 346.185
Liked this program? Do Like & share with your friends
The post Java program to calculate area of a circle with the output appeared first on FreeWebMentor.
This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here