Last active
October 13, 2015 16:07
-
-
Save BigWillie/4220915 to your computer and use it in GitHub Desktop.
Fizz buzz boom! - Robs fizz buzz answer
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
// Robs Fizz Buzz with a boom!... with long winded if statements :) | |
// Try it here: http://eloquentjavascript.net/paper.html | |
var f = "Fizz", | |
b = "Buzz"; | |
for (i = 1; i <= 101; i++) | |
{ | |
if (i%3 == 0 && i%5 == 0) { | |
console.log(f + b); | |
} else if (i%3 == 0) { // if there is no remainder, then i is divisible by 3 | |
console.log(f); | |
} else if (i%5 == 0) { | |
console.log(b); | |
} else { | |
if(i >= 100) { | |
console.log("BOOM!"); | |
}else{ | |
console.log(i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment