Created
September 26, 2018 19:37
-
-
Save ippaiva/a09a91cf11f5045a18b1282c8581f582 to your computer and use it in GitHub Desktop.
IronHack JS.Exercise created by ippaiva - https://repl.it/@ippaiva/IronHack-JSExercise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Print the numbers 1 through 50. | |
If the number is divisible by 7, you must skip the next number. | |
If the number is divisible by 10 or 15, you must print “Donkey!”. | |
If the number is not divisible by 2 and the previous number is divisible by 10, you must print “Monkey!”.*/ | |
for (var i = 1; i < 50; i++) { | |
if (i % 10 === 0 || i % 15 === 0) | |
console.log("Donkey"); | |
else if (i % 7 === 0) { continue; } | |
else if (i % 2 !== 0) | |
console.log("monkey"); | |
else | |
console.log(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment