988. Calculate the Area of a Circle

Given an integer r representing the radius of a circle, return the area of the circle, calculated using the formula:

  Area = π × r²

Use the value of π as 3.14 and return the result rounded to 1 decimal place.

Example 1:

Input: r = 5

Output: 78.5

Explanation: Area = 3.14 × 25 = 78.5

Example 2:

Input: r = 4

Output: 50.2

Explanation: Area = 3.14 × 16 = 50.24 → rounded to 50.2

Now Your Turn!

Pick the correct output for the given input

Input: r = 1

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

1 <= r <= 104

0
class Solution {
public:
double areaOfCircle(int r) {
// Your code goes here
}
};
Test Case

Input:

R