Skip to content

Instantly share code, notes, and snippets.

@simeonwillbanks
Created October 31, 2011 19:05
Show Gist options
  • Save simeonwillbanks/1328512 to your computer and use it in GitHub Desktop.
Save simeonwillbanks/1328512 to your computer and use it in GitHub Desktop.
#JavaScript #FizzBuzz #ProgrammingChallenge
(function(){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);} }})();
@elimisteve
Copy link

From my solution at https://github.com/sbhackerspace/sbhx-snippets/blob/master/py/fizzbuzz.py --

for num in xrange(1, 101):
    line = ""
    if num % 3 == 0:
        line += "Fizz"
    if num % 5 == 0:
        line += "Buzz"
    print line if line else num

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment