Last active
July 3, 2019 21:53
-
-
Save hissy/ad620d6becd04c97c475ef1d6f705ced to your computer and use it in GitHub Desktop.
FizzBuzz for PHP 出題ファイル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* FizzBuzz 問題 | |
* * 3で割り切れる場合は Fizz と出力 | |
* * 5で割り切れる場合は Buzz と出力 | |
* * 3でも5でも割り切れる場合は Fizz Buzz と出力する | |
* | |
* Fork ボタンでフォークして作業開始 | |
* | |
* スクリプトの実行方法 $ php fizzbuzz.php | |
* | |
* 調べていいのは https://www.php.net だけ! | |
*/ | |
$numbers = range(1,100); | |
foreach ($numbers as $number) { | |
echo $number; | |
echo PHP_EOL; | |
} | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
解答例:functionを使う https://gist.github.com/hissy/abc443299e8a564048ba1fbde8337acb