Java Program to Find the Area of Circle - The Coding Shala
Home >> Java Programs >> Area of Circle
Other Posts You May Like
In this post, we will learn how to write a Java Program to Find the Area of Circle.
Java Program to Find the Area of Circle
The radius of the circle is given, find the area of the circle using the Java program.
Area of Circle = Pi * (radius * radius)
Example 1:
Input: radius = 3
Output: Area = 28.274333882308138
Java Program:
// Java program to Find Area of Circle import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // take radius input System.out.println("Enter the radius of circle"); double radius = sc.nextDouble(); // calculate the area // area = Pi * (radius * radius) double area = Math.PI * (radius * radius); System.out.println("Area of Circle is: " + area); sc.close(); } }
Output:
Enter the radius of circle 3 Area of Circle is: 28.274333882308138
- Java Program to Find the Area of Triangle
- Java Program to Swap Two Numbers
- Java Program to Add Two Numbers
- Java Program to Find Sum of Digits of a Number
- Java Program to Multiply Two Numbers
Comments
Post a Comment