write a program to input the radius of a circle and calculate its area
Answers
Answered by
2
Answer:
import java.util.*;
public class Circle
{
public static void main(String args [])
{
Scanner in=new Scanner(System.in);
float r,a;
System.out.println("Enter the radius of the circle");
r=in.nextFloat();
a=(22/7)*Math.pow(r,2);
System.out.println("The area is =" +a);
}
}
Explanation:
● The radius or the area may can be in decimal point so, we should accept the values in float data type.
● For a circle,
Area = pie.r^2.
Similar questions
Math,
4 months ago
Science,
4 months ago
Computer Science,
9 months ago
Economy,
1 year ago
Science,
1 year ago