a Java program to generate the area of circle
Answers
Answered by
0
class AreaofCircle{
public static void main()
{
{
int r = 7;
int Area = 22/7 * 7 * 7;
System.out.println("Area of circle = " + Area);
}
}
}
Output
Area of circle = 154
____________________________________________________________________________________
Java is a predifined computer specialized coding.
Java follows some rules in the programs.
public static void main()
{
{
int r = 7;
int Area = 22/7 * 7 * 7;
System.out.println("Area of circle = " + Area);
}
}
}
Output
Area of circle = 154
____________________________________________________________________________________
Java is a predifined computer specialized coding.
Java follows some rules in the programs.
Answered by
0
Hi
Here is your answer hope it helps you
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 Enter radius of circle:5 Area of circle:78.5
Thanks plz mark me brainliest
Here is your answer hope it helps you
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 Enter radius of circle:5 Area of circle:78.5
Thanks plz mark me brainliest
Similar questions