Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created December 23, 2010 12:40
Show Gist options
  • Save yaotti/752913 to your computer and use it in GitHub Desktop.
Save yaotti/752913 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def fizzbuzz(n)
if n % 3 == 0
print "Fizz"
end
if n % 5 == 0
print "Buzz"
end
if n % 3 * n % 5 != 0
print n
end
print "\n"
end
for i in 1..(ARGV[0] ? ARGV[0].to_i : 100)
fizzbuzz(i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment