Skip to content

Instantly share code, notes, and snippets.

@DQNEO
Last active October 11, 2015 00:27
Show Gist options
  • Save DQNEO/3773814 to your computer and use it in GitHub Desktop.
Save DQNEO/3773814 to your computer and use it in GitHub Desktop.
FizzBuzz問題

FizzBuzz問題

問題1(10分)

1から30までの数字を改行付きで出力してください。 ただし、

  • 3の倍数の場合は、上記の代わりに"foo"という文字列を出力
  • 5の倍数の場合は、上記の代わりに"bar"という文字列を出力
  • 3の倍数かつ5の倍数の場合は、上記の代わりに"foobar"という文字列を出力

出力例:

1
2
foo
4
bar
(中略)
14
foobar
16

問題2(5分)

問題1で書いたコードを書き直して、、可読性・保守性の観点で改善してください。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment