Implement the method calculateCircleArea that takes the radius of a circle as a float and returns its area.

Beginner Level
Math
Write a method to compute the area of a circle using the formula: Area = π × radius²
  • Use π = 3.14 for calculation.
  • The radius is provided as a float input.
  • The returned value should also be a float.
Example 1
Input:
r (float) = 2
Return:
(double) 12.56
Example 2
Input:
r (float) = 3.5
Return:
(double) 38.465

To calculate the area of a circle:

  • Use the formula Area = 3.14 × radius × radius
  • Accept the radius as input
  • Return the area as a float value

Pseudocode:

Function calculateCircleArea(radius):
    return 3.14 * radius * radius
Run your code to see the result.