In this article, we are going to write a java program to calculate the area of a circle. We will use the java Scanner class for taking radius input from the User
Area of Circle
We can calculate area of circle by using following formula
Area = pi * r*r
Here pi = 3.14 , r is radius of circle
Java Program to Calculate Area of Circle
Steps to Calculate Area of Circle using Programming Language
- Take radius input from user
- Calculate Area of circle by using formula pi*r*r
- Print the Area of Circle
Java Code for Area of Circle
package gangforcode;
import java.util.Scanner;
public class AreaofCircle {
public static void main(String[] args) {
final double pi = 3.14;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the radius of Circle");
double radius = sc.nextDouble();
double area = pi*radius*radius;
System.out.println("Area of Circle = " +area);
}
}
Output for java code:-
You can calculate the area of a circle in the same way in other programming languages like C, C++ Python, etc
Similar Java Programs Tutorial
Matrix Addition in Java – https://gangforcode.com/matrix-addition-in-java/
Binary Search in Java – https://gangforcode.com/binary-search-in-java/
first non repeating character – https://gangforcode.com/fiirst-non-repeating-character-in-the-string/
Armstrong number in java – https://gangforcode.com/armstrong-number-in-java/
All Armstrong Numbers – https://gangforcode.com/all-armstrong-numbers/
Very nice post. I definitely appreciate this site. Stick with it!
I was excited to uncover this site. I need to to thank you for your time for this particularly wonderful read!! I definitely savored every part of it and I have you saved to fav to see new stuff in your site.
Good post. I learn something totally new and challenging on blogs I stumbleupon on a daily basis. Its always useful to read content from other authors and practice something from their websites.
Greetings! Very useful advice within this article! Its the little changes that make the most significant changes. Thanks a lot for sharing!