Skip to content

Practice Problem 6

Seanti edited this page Mar 26, 2025 · 2 revisions

Problem:

Create a method called calculateArea(double radius) that returns the area of a circle using the formula:

Area=π×radius2\text{Area} = \pi \times \text{radius}^2

Call this method from main() and display the result.

Sample Output:

Enter the radius of the circle: 5  
Area of the circle: 78.54  

Clone this wiki locally