We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I understand and am able to solve the problem yet I don't know how to answer it for hackerrank!!!
function main(r) {
// Write your code here. Read input using 'readLine()' and print output using 'console.log()'.
const PI = Math.PI;
let area = PI * Math.pow(r, 2);
let perimeter = PI * 2 * r;
console.log(area);
console.log(perimeter);
// Print the area of the circle:
// Print the perimeter of the circle:
try {
// Attempt to redefine the value of constant variable PI
PI = 0;
// Attempt to print the value of PI
console.log(PI);
} catch(error) {
console.error("You correctly declared 'PI' as a constant.");
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Let and Const
You are viewing a single comment's thread. Return to all comments →
I understand and am able to solve the problem yet I don't know how to answer it for hackerrank!!!
}