Skip to content

Instantly share code, notes, and snippets.

@Neptune998
Created August 7, 2020 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neptune998/4bd342591ea73500491944e6e4fefbef to your computer and use it in GitHub Desktop.
Save Neptune998/4bd342591ea73500491944e6e4fefbef to your computer and use it in GitHub Desktop.
function main() {
// Write your code here. Read input using 'readLine()' and print output using 'console.log()'.
const PI = Math.PI;
var s = readLine();
// Print the area of the circle:
console.log(PI*parseFloat(s)*parseFloat(s));
// Print the perimeter of the circle:
console.log(2*PI*parseFloat(s));
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.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment