Skip to content

Instantly share code, notes, and snippets.

@juliaamosova
Created September 28, 2017 02:51
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 juliaamosova/202309efc9e8ccab637c71e6cf84740d to your computer and use it in GitHub Desktop.
Save juliaamosova/202309efc9e8ccab637c71e6cf84740d to your computer and use it in GitHub Desktop.
Given an integer n, perform several conditional actions.
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
/////////////// ignore above this line ////////////////////
function main() {
var N = parseInt(readLine());
if (N % 2 !== 0 && N >= 1 && N <= 100) {
console.log("Weird");
} else if (N % 2 === 0 && N >= 2 && N <= 5) {
console.log("Not Weird");
} else if (N % 2 === 0 && N >= 6 && N <= 20) {
console.log("Weird");
} else if (N % 2 === 0 && N > 20 && N <= 100) {
console.log("Not Weird");
} else {
console.log("You must enter the number between 1 and 100");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment