Skip to content

Instantly share code, notes, and snippets.

@m5151128
Last active January 11, 2018 04:41
Show Gist options
  • Save m5151128/aac93cc36d6149a16249f435ee75ff16 to your computer and use it in GitHub Desktop.
Save m5151128/aac93cc36d6149a16249f435ee75ff16 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 foo (中略) 14 foobar 16

問題2(5分)

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

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