Math, asked by chhavi7555, 11 months ago

Write aprogram that reads in the radious of a circle and then computes its area

Answers

Answered by Anonymous
0

Answer:

This is a Java Program to Calculate and Display Area of a Circle.

Formula:

Perimeter of circle=pi * radius * radius

Enter the radius of the circle as input. Now we use the given formula to calculate the area of the circle using formula.

Here is the source code of the Java Program to Calculate and Display Area of a Circle. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.

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

Answered by as8ab0
0

5 begin

10 read r /*radius*/

20 pi=22/7 /*declare constant*/

30 area=pi*r^2

40 display area

45 end

Step-by-step explanation:

line 20 declares pick as a constant

line 10 reads input

line 30 calculates area of circle and line 40 displays output

Similar questions