lernen prog-p added (nicht alles) 1/2

This commit is contained in:
danielvici123
2024-11-12 22:47:12 +01:00
parent 61872b31cf
commit d8de12e6d7
9 changed files with 274 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Rate die Zahl!</h1>
<form action="raten.php">
<label for="id_zahl">Zahl:</label>
<input type="number" name="name_zahl" id="id_zahl">
<button type="submit">Raten</button>
</form>
<?php
$zahl = $_REQUEST['input_zahl'];
$random = rand(1, 100);
if ($zahl == $random) {
echo "<p>Richtig!</p>";
if ($zahl % 2 == 0) {
echo "<p>Die Zahl ist gerade!</p>";
} else {
echo "<p>Die Zahl ist ungerade!</p>";
}
} else {
echo "Falsch!";
if ($zahl % 2 == 0) {
echo "<p>Die Zahl ist gerade!</p>";
} else {
echo "<p>Die Zahl ist ungerade!</p>";
}
}
?>
</body>
</html>