Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created December 14, 2011 23:28
Show Gist options
  • Save jhsu/1479089 to your computer and use it in GitHub Desktop.
Save jhsu/1479089 to your computer and use it in GitHub Desktop.
class FizzBuzz
def self.run
# your solution goes here
# use "puts" to print out a number, "fizz", or "buzz"
(1..100).each do |n|
output = ""
output += "Fizz" if (n%3).zero?
output += "Buzz" if (n%5).zero?
puts output.empty? ? n : output
end
end
end
FizzBuzz.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment