Skip to content

Instantly share code, notes, and snippets.

@alfielapeter
Created March 3, 2011 18:26
Show Gist options
  • Save alfielapeter/853225 to your computer and use it in GitHub Desktop.
Save alfielapeter/853225 to your computer and use it in GitHub Desktop.
basic fizzbuzz in ruby
for n in 1..100
if n.remainder(3) == 0 && n.remainder(5) == 0
puts "fizzbuzz"
elsif n.remainder(3) == 0
puts "fizz"
elsif n.remainder(5) == 0
puts "buzz"
else
puts n
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment