Created
November 15, 2013 04:50
-
-
Save sranso/7479296 to your computer and use it in GitHub Desktop.
fizzbuzz.js
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
// prints numbers 1-100 | |
// when the number is divisible by 3, say fizz | |
// when the number is divisible by 5 say buzz | |
// when the number is divisible by 3 and 5 say fizzbuzz | |
for (var i = 1; i <= 100; i++) | |
{ | |
if (i % 3 == 0 && i % 5 == 0) {console.log("fizzbuzz")} | |
else if (i % 3 == 0) {console.log("fizz")} | |
else if (i % 5 == 0) {console.log("buzz")} | |
else {console.log(i)} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment