public class CalculateCircleAreaExample {
public static void main(String[] args) {
int radius =5;
System.out.println("The radius of the circle is " + radius);
double area = Math.PI * radius * radius;
System.out.println("Area of a circle is " + area);
}
}
public static void main(String[] args) {
int radius =5;
System.out.println("The radius of the circle is " + radius);
double area = Math.PI * radius * radius;
System.out.println("Area of a circle is " + area);
}
}
Run the program in command prompt as explained in first example
output:
The radius of the circle is 5
Area of a circle is 78.5
Post a Comment