42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Z76 - Od A do B</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Zadanie Z76</h1>
|
|
<h2>Autor: Jakub Grzegorczyk</h2>
|
|
</header>
|
|
<div class="box">
|
|
<p>Napisz program, który dla podanych liczb całkowitych A i B wyświetla wszystkie liczby całkowite z przedziału od A do B oddzielone średnikami.</p>
|
|
</div>
|
|
<div class="box">
|
|
<form action="index.php" method="post">
|
|
<label for="a">Wprowadź liczbę A: </label>
|
|
<input type="number" name="a" id="a">
|
|
<label for="b">Wprowadź liczbę B:</label>
|
|
<input type="number" name="b" id="b">
|
|
<button type="submit">Wyślij</button>
|
|
</form>
|
|
</div>
|
|
<div class="box">
|
|
<?php
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|
$a = (int)htmlspecialchars($_POST['a']);
|
|
$b = (int)htmlspecialchars($_POST['b']);
|
|
$liczby = [];
|
|
for ($i = $a; $i <= $b; $i++) {
|
|
$liczby[] = $i;
|
|
}
|
|
echo implode('; ', $liczby);
|
|
}
|
|
?>
|
|
</div>
|
|
</body>
|
|
</html>
|