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

17 lines
691 B
PHP
Raw 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に代入してください
// ヒント:inputタグのname属性を確認しましょう
$input = ($_POST[???]);
// numに、input(文字列)を数値変換した値を代入します
// ※ 入力された値が、数字ではなかった場合はプログラムがエラーになります
$num = intval($input); // intval(文字列)で数値変換している
// TODO: 入力された値が3で割り切れるすうじか判定する条件式を記述してください
if () {
print "3で割り切れる数字です"
} else {
print "3で割り切れない数字です"
}