31.10
This commit is contained in:
41
Zadania/Z89 - N Potęg dwójki/index.php
Normal file
41
Zadania/Z89 - N Potęg dwójki/index.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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>Z89 - N potęg dwójki</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Zadanie Z89</h1>
|
||||
<h2>Autor: Jakub Grzegorczyk</h2>
|
||||
</header>
|
||||
<div class="box">
|
||||
<p>Napisz program, który dla podanej liczby całkowitej N oblicza N kolejnych potęg dwójki.</p>
|
||||
</div>
|
||||
<div class="box">
|
||||
<form action="index.php" method="post">
|
||||
<fieldset>
|
||||
<label for="n">Podaj N:</label>
|
||||
<input type="text" name="n" id="n">
|
||||
</fieldset>
|
||||
<button type="submit">Wyślij</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$n = htmlspecialchars($_POST['n']);
|
||||
echo '<div class="box">';
|
||||
for ($i = 1; $i <= $n; $i++) {
|
||||
echo "2<sup>$i</sup> = <b>" . pow(2, $i) . "</b><br>";
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user