Write a program in Java to assign radius of value.find and print area of circle using the formula area = pi*r2
Answers
Answered by
7
Answer:
import java.util.Scanner;
public class Area
{
public static void main(String[] args)
{
int r;
double pi = 3.14, area;
Scanner s = new Scanner(System.in);
System.out.print("Enter radius of circle:");
r = s.nextInt();
area = pi * r * r;
System.out.println("Area of circle:"+area);
}
}
Output:
$ javac Area.java
$ java Area
Similar questions
Math,
4 months ago
Social Sciences,
4 months ago
Science,
4 months ago
Math,
9 months ago
Social Sciences,
9 months ago
English,
1 year ago
Physics,
1 year ago
Social Sciences,
1 year ago