Explanation

520.Calculate the Area of a Circle

Easy
Given the radius of a circle, return its area rounded to two decimal places. The formula is the familiar πr². What makes it a variables-and-types exercise is π itself: it is not a whole number, so the area must live in a floating-pointFloating-Point NumberA number stored with a fractional part, such as a double. It can hold 3.14159… approximately. variable even though the radius is an int. Most languages provide π as a named constantNamed ConstantA fixed value given a readable name (like Math.PI) so you do not have to type its digits.; in C you define it yourself. The two solutions differ only in how the radius is squared.

Example 1:

Input: radius = 7

Output: "153.94"

Example 2:

Input: radius = 1

Output: "3.14"

+ 5 hidden test cases run on Submit.

Constraints:

  • ●1 ≤ radius ≤ 10000

radius =

7