Skip to content

Instantly share code, notes, and snippets.

@zachelko
Created April 30, 2010 19:33
Show Gist options
  • Save zachelko/385656 to your computer and use it in GitHub Desktop.
Save zachelko/385656 to your computer and use it in GitHub Desktop.
FizzBuzz
# Zach J. Elko
#
# Solution for the programming question listed here:
# http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
#
for i in range(1, 101):
multipleOf3 = (i % 3 == 0)
multipleOf5 = (i % 5 == 0)
if multipleOf3 and multipleOf5:
print 'FIZZBUZZ'
elif multipleOf3:
print 'FIZZ'
elif multipleOf5:
print 'BUZZ'
else:
print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment