Write a program to calculate the area of a circle as follows:
Assign the circle radius.
Compute the area using this formula: area = radius X radius X 3.14159
Display the area.
Below is a sample output if how the output should look:
The area for the circle of radius 10.0 is 314.159
public class AreaOfCircle { public static void main(String[] args) { // Assign the circle radius. double radius = 10.0; // Compute the area using this formula: area = radius X radius X 3.14159 double area = radius*radius*3.14159; // Display the area. System.out.println("The area for the circle of radius "+radius+" is "+area); } }
Get Answers For Free
Most questions answered within 1 hours.