This commit is contained in:
3p01
2025-10-30 12:22:07 +01:00
parent db1d8ff09f
commit 1c1e77cf14
7 changed files with 1029 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
<?php
?>
<!doctype html>
<html lang="pl">
<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>Z83 - Przekątna 1</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z83</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
<p>Napisz program, który dla podanej liczby całkowitej A oznaczającej ilość znaków w wierszu wyświetla następujący blok znaków.</p>
<pre>
Przykład:
A=5
10000
01000
00100
00010
00001</pre>
</div>
<div class="box">
<form action="index.php" method="post">
<fieldset>
<label for="a">Podaj A:</label>
<input type="number" name="a" id="a" min="1" required>
</fieldset>
<button type="submit">Wyślij</button>
</form>
</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$a = (int)htmlspecialchars($_POST['a']);
echo '<div class="box">';
echo "A: $a <br>";
for ($i = 0; $i <= $a; $i++) {
echo str_repeat('0', $i) . '<b>1</b>' . str_repeat('0', $a - $i);
echo '<br>';
}
}
?>
</body>
</html>