Beginner Level
Implement the method calculateCircleArea that takes the radius of a circle as a float and returns its area.
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) =
2Returns (double)
12.56Example 2
Input
r (float) =
3.5Returns (double)
38.465Example 3
Input
r (float) =
1Returns (double)
3.14To 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
Ready to test your solutionRun Code checks your solution against the test cases.Shift + Enter to run