Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fizzbuzz added #1

Merged
merged 3 commits into from Oct 7, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions fizzbuzz.rb
@@ -0,0 +1,16 @@
input = gets
num = input.to_i

(1..num).each do |i|

if i%15 == 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%も演算子なので両サイドに半角スペースがあった方が良いですね!

puts "FizzBuzz!"
elsif i%3 == 0
puts "Fizz!"
elsif i%5 == 0
puts "Buzz!"
else
puts i
end

end