Skip to content

Instantly share code, notes, and snippets.

@takoikatakotako
Created March 5, 2017 05:12
Show Gist options
  • Select an option

  • Save takoikatakotako/08ecaa1c16ccb1c67603755e2d973dc9 to your computer and use it in GitHub Desktop.

Select an option

Save takoikatakotako/08ecaa1c16ccb1c67603755e2d973dc9 to your computer and use it in GitHub Desktop.
FizzBuzzをRubyで解きました。
for num in 1..20 do
if num%3 == 0 && num%5 == 0 then
puts('Fizz Buzz')
elsif num%3 == 0 then
puts('Fizz')
elsif num%5 == 0
puts('Buzz')
else
puts(num)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment