Here is the java code for finding the area of a circle.
You need to import "Scanner class", so that you can take input from user.That input will be radius of the circle.
package javaapplication2;import java.util.Scanner;public class JavaApplication2{public static void main(String[] args){double radius;double area;Scanner input=new Scanner(System.in);System.out.print("Enter Radius: ");radius=input.nextDouble();area = radius *radius * 3.14;System.out.println("The area of the circle of radius " + radius +" is " +area);}}
If you found any error in this code or if you have a better and short java code for this work then please feel free to send it on our email so that we can upload it too.
Our contact email is : K.ahmed2k19@gmail.com
If you like it then share it with your friends.Keep visiting and keep learning.
0 comments:
Post a Comment