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

21 lines
880 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// TODO: 前画面で入力した「西暦」を受け取ったうえで変数inputに代入してください
// numに、input(文字列)を数値変換した値を代入します
// ※ 入力された値が、数字ではなかった場合はプログラムがエラーになります
$num = intval($input); // intval(文字列)で数値変換している
/* TODO:
* 入力された値(西暦)がうるう年かどうか判定する条件式を追加してください
*
* うるう年の条件
* ● 西暦の年が 4 で割り切れる年は原則として「~年はうるう年です。」
* ● ただし、100で割り切れたら「~年はうるう年ではありません。」
* ● しかし、400で割り切れるなら「~年はうるう年です。」と表示する
*
* ※ プログラムは何行書いても良いです
*/