Skip to content

Instantly share code, notes, and snippets.

@FaisalFehad
Created August 1, 2017 15:38
Show Gist options
  • Save FaisalFehad/7fda04a4281956386380ec7345f510a6 to your computer and use it in GitHub Desktop.
Save FaisalFehad/7fda04a4281956386380ec7345f510a6 to your computer and use it in GitHub Desktop.
Prints bizz on multiple of 3, buzz on multiple of 5 and bizzbuzz on a multiple of both 3 and 5
# prints bizz on multiple of 3, buzz on multiple of 5 and bizzbuzz on a multiple of both 3 and 5
100.times do |i|
if i % 3 && i % 5 == 0
puts "FizzBuzz"
elsif i % 3 == 0
puts "Fiz"
elsif i % 5 == 0
puts "Buzz"
else
puts i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment