Skip to content

Instantly share code, notes, and snippets.

@NickyBobby
Created December 1, 2015 16:43
Show Gist options
  • Select an option

  • Save NickyBobby/b44042c0eb5895266111 to your computer and use it in GitHub Desktop.

Select an option

Save NickyBobby/b44042c0eb5895266111 to your computer and use it in GitHub Desktop.
0.upto 1000 do |x|
if x%3==0 && x%5==0 && x%7==0
puts "SuperFizzBuzz"
elsif x%3==0 && x%7==0
puts "SuperFizz"
elsif x%5==0 && x%7==0
puts "SuperBuzz"
elsif x%3==0
puts "Fizz"
elsif x%5==0
puts "Buzz"
elsif x%7==0
puts "Super"
else
puts x
end
end
for i in 0..1000
puts i%3==0 ? i%5==0 ? i%7==0 ? "SuperFizzBuzz" : "FizzBuzz" : "Fizz" : i%5==0 && i%7==0 ? "SuperBuzz" : i%3==0 && i%7==0 ? "SuperFizz" : i%5==0 ? "Buzz" : i%7==0 ? "Super" : i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment