PROBLEM 10
Easy

Circle Area

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#10

Given circle radius `r`, use π = 3.14 and print the area `πr²`.

EXAMPLE

Example

Input
5
Output
78.5

LIMITS

Constraints

All numeric input values fit in JavaScript `Number`.
📖
LEARN Theory for this problem
+

### Circle Area

JavaScript arithmetic works with numeric values stored in variables. A clear solution reads the needed values, computes the formula with `+`, `-`, `*`, `/` or `**`, and prints only the final result.

💡
NEED HELP? Hints
+

['Write the formula using named intermediate values if it contains more than one operation.', 'Match each input value type to the operation performed on it: JavaScript string and numeric behavior differ significantly.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let r = Number(input);
let result = ((3.14) * (r ** 2));
console.log(Object.is(result, 0) ? '0.0' : result);