This commit is contained in:
2p01
2025-05-21 11:11:37 +02:00
parent b8f950e6cc
commit 7125af9b1d
8 changed files with 407 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<!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>Z30 - Ułamek właściwy</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z30</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
Napisz program, który: ułamek niewłaściwy w postaci licznik/mianownik zamienia na właściwy np. licznik=4 mianowmik=3 odpowiedź 1 i 1/3. W wersji podstawowej funkcja nie musi skracać ułamka.
</div>
<div class="box">
<form action="index.php" method="post">
<label for="licznik">Podaj licznik: </label><br>
<input type="number" name="licznik" id="licznik"><br><br>
<label for="mianownik">Podaj mianownik: </label><br>
<input type="number" name="mianownik" id="mianownik"><br><br>
<button type="submit">Oblicz</button>
<br>
</form>
</div>
<div class="box">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$licznik = (int)htmlspecialchars($_POST['licznik']);
$mianownik = (int)htmlspecialchars($_POST['mianownik']);
if ($mianownik != 0) {
$calosc = intdiv($licznik, $mianownik);
$reszta = $licznik % $mianownik;
if ($reszta == 0) {
echo "Wynik: $calosc";
} else {
echo "Wynik: $calosc i $reszta/$mianownik";
}
} else {
echo "Błędne dane wejściowe.";
}
}
?>
</body>
</html>

View File

@@ -0,0 +1,51 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 30px;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
div {
border: 2px solid black;
padding: 20px;
border-radius: 1em;
margin: 10px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
input {
margin-top: 10px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
}
pre {
font-family: Verdana, serif;
}
.box p {
padding: 10px 15px 20px;
display: none;
}
.box h3 {
cursor: pointer;
}

View File

@@ -0,0 +1,54 @@
<!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>Z31 - Pole z wierzchołków</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z31</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
Napisz program, który: dla współrzędnych wierzchołka trójkąta (x1,y1), (x2,y2),(x3,y3), oblicza jego pole powierzchni
<img src="img.png" alt="Wzór">
</div>
<div class="box">
<form action="index.php" method="post">
<label for="x1">Podaj x<sub>1</sub>: </label><br>
<input type="number" name="x1" id="x1"><br><br>
<label for="y1">Podaj y<sub>1</sub>: </label><br>
<input type="number" name="y1" id="y1"><br><br>
<label for="x2">Podaj x<sub>2</sub>: </label><br>
<input type="number" name="x2" id="x2"><br><br>
<label for="y2">Podaj y<sub>2</sub>: </label><br>
<input type="number" name="y2" id="y2"><br><br>
<label for="x3">Podaj x<sub>3</sub>: </label><br>
<input type="number" name="x3" id="x3"><br><br>
<label for="y3">Podaj y<sub>3</sub>: </label><br>
<input type="number" name="y3" id="y3"><br><br>
<button type="submit">Oblicz</button>
<br>
</form>
</div>
<div class="box">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$x1 = (float)htmlspecialchars($_POST['x1']);
$y1 = (float)htmlspecialchars($_POST['y1']);
$x2 = (float)htmlspecialchars($_POST['x2']);
$y2 = (float)htmlspecialchars($_POST['y2']);
$x3 = (float)htmlspecialchars($_POST['x3']);
$y3 = (float)htmlspecialchars($_POST['y3']);
$pole = abs(($x1 * ($y2 - $y3) + $x2 * ($y3 - $y1) + $x3 * ($y1 - $y2)) / 2);
echo "Pole powierzchni trójkąta wynosi: " . round($pole, 2);
}
?>
</div>
</body>
</html>

View File

@@ -0,0 +1,51 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 30px;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
div {
border: 2px solid black;
padding: 20px;
border-radius: 1em;
margin: 10px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
input {
margin-top: 10px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
}
pre {
font-family: Verdana, serif;
}
.box p {
padding: 10px 15px 20px;
display: none;
}
.box h3 {
cursor: pointer;
}

View File

@@ -0,0 +1,51 @@
<!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>Z32 - Większa z losowych</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z32</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
Napisz program, który losuje dwie liczby pseudolosowe z zakresu od a do b, wyświetla te liczby i określa która z nich jest większa, mniejsza, czy liczby równe.
</div>
<div class="box">
<form action="index.php" method="post">
<label for="a">Podaj a: </label><br>
<input type="number" name="a" id="a" placeholder="1"><br><br>
<label for="b">Podaj b: </label><br>
<input type="number" name="b" id="b" placeholder="10"><br><br>
<button type="submit">Losuj</button>
<br>
</form>
</div>
<div class="box">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$a = (int)htmlspecialchars($_POST['a']);
$b = (int)htmlspecialchars($_POST['b']);
$losowa1 = rand($a, $b);
$losowa2 = rand($a, $b);
echo "Wylosowane liczby: $losowa1 i $losowa2<br>";
if ($losowa1 > $losowa2) {
echo "$losowa1 > $losowa2";
} elseif ($losowa1 < $losowa2) {
echo "$losowa1 < $losowa2";
} else {
echo "$losowa1 = $losowa2";
}
}
?>
</div>
</body>
</html>

View File

@@ -0,0 +1,51 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 30px;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
div {
border: 2px solid black;
padding: 20px;
border-radius: 1em;
margin: 10px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
input {
margin-top: 10px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
}
pre {
font-family: Verdana, serif;
}
.box p {
padding: 10px 15px 20px;
display: none;
}
.box h3 {
cursor: pointer;
}

View File

@@ -0,0 +1,46 @@
<!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>Z33 - Dzielenie ze sprawdzeniem</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Zadanie Z33</h1>
<h2>Autor: Jakub Grzegorczyk</h2>
</header>
<div class="box">
Napisz program, który: <br>
dla liczb całkowitych A i B sprawdza czy B nie jest równe 0 i tylko w tym wypadku wykonuje dzielenie. Program powinien sprawdzić również, czy podana liczba nie jest rzeczywista.
</div>
<div class="box">
<form action="index.php" method="post">
<label for="a">Podaj A: </label><br>
<input type="number" name="a" id="a"><br><br>
<label for="b">Podaj B: </label><br>
<input type="number" name="b" id="b"><br><br>
<button type="submit">Oblicz</button>
<br>
</form>
</div>
<div class="box">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$a = (int)htmlspecialchars($_POST['a']);
$b = (int)htmlspecialchars($_POST['b']);
if ($b != 0) {
$wynik = $a / $b;
echo "Wynik dzielenia: " . round($wynik, 2);
} else {
echo "Błąd: Dzielenie przez zero!";
}
}
?>
</div>
</body>
</html>

View File

@@ -0,0 +1,51 @@
* {
box-sizing: border-box;
}
body {
font-family: Verdana, serif;
background: #ffffff;
margin: 30px;
}
header {
border: 2px solid black;
border-radius: 1em;
padding: 20px;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
background: #f0f0f0;
}
div {
border: 2px solid black;
padding: 20px;
border-radius: 1em;
margin: 10px 0 10px 0;
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
}
input {
margin-top: 10px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
height: 2em;
}
button {
padding: 5px;
width: 30%;
border: black 2px solid;
border-radius: 0.5em;
font-weight: bold;
}
pre {
font-family: Verdana, serif;
}
.box p {
padding: 10px 15px 20px;
display: none;
}
.box h3 {
cursor: pointer;
}