Files
php-question/Question03-if/Ex06.php
2026-10-06 12:10:09 +09:00

20 lines
759 B
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$limitNumber = 100;
// ランダムで数字を生成するプログラムです。
// 下記の命令を実行すると変数randomに、0以上、変数limitNumber未満の数字がランダムで代入されます
$random = mt_rand(0, $limitNumber);
/* TODO:
* 以下の仕様に沿ってプログラムを完成させてください
*
* ●変数randomの値から、出力する値を変更します。
* ●1%の確率 -> 「☆☆☆☆☆」 >> 要は1/100なので0と一致するようにしてください
* ●30%の確率 -> 「☆☆☆☆」 >> 1~30の30個の数字が当てはまるようにしてください
* ●上記以外の場合 -> 「☆☆☆」
*
* ※ プログラムは何行書いても良いです
*/