You are provided with the radius of a circle "A". Find the length of its circumference.
Note: In case the output is coming in decimal, roundoff to 2nd decimal place. In case the input is a negative number, print "Error".
Input Description:
The Radius of a circle is provided as the input of the program.
Output Description:
Calculate and print the Circumference of the circle corresponding to the input radius up to two decimal places.
Sample Input :
2
Sample Output :
12.57
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = parseFloat(data[0]);
var b = (2*3.142*a)
if(a>=-1)
console.log(b.toFixed(2));
else
console.log("error")
});
Comments
Post a Comment