Area of a Circle
| Posted in Java , Pi | Posted on 5:50 PM
PI is best served with ice cream, or a cold glass of milk. Sometimes though it goes just fine with some fresh Java. This program takes a given radius (unprompted) and calculates the area of the circle that radius would create.
/* This is a simple program to calculate
* the area of a circle. To begin, the
* radius will be a fixed variable.
*/
package calculateareaofcircle;
/**
*
* @author Neil
*/
public class Main {
public static void main(String[] args) {
double area;
double radius;
radius=20;
area=3.14*radius*radius;
System.out.println("The area of the circle with a radius of " +
radius + " is " + area);
}
}
Comments Posted (0)
Post a Comment