write a program in Java to calculate the area of circle.
Answers
Answer:
Enter radius of circle:5
Area of circle:78.5
Explanation:
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);
}
}
Answer:
public class AreaCircle
{
public void calcCircArea( )
{
double radius = 7.5 ;
double area = 3.14149 * radius * radius ;
System.out.print("Area or Circle :" + area) ;
}
}
Java:
Java is a popular third-generation programming language, which can be used to do any of the thousands of things that a computer software can do. With the features it offers, Java has become the language of choice for internet and intranet applications.