Skip to content

Commit

Permalink
uu
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenBloodDev committed Sep 20, 2023
1 parent b958d1b commit 497e81a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/quatalumsatz.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
echo "Quatal " . ($i + 1) . ": " . $umsaetze[$i] . "€<br>";
}

echo "Das niedrigste Einkommen beträgt " . min($umsaetze) . "€<br>";
echo "Das höchste Einkommen beträgt " . max($umsaetze) . "€<br>";

?>
Expand Down
61 changes: 61 additions & 0 deletions src/temperatur.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!doctype html>
<html lang="de">
<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>Temperatur</title>
</head>
<body>

<?php

$temp = array(27, 18, 12, 13, 15, 20, 25);
$total = count($temp);
$count = 0;

for ($i = 0; $i < $total; $i++){
echo "Temperatur Tag ". ($i+1) . ": $temp[$i] Grad<br>";
$count = $count + $temp[$i];
}

echo "<br>";
echo "Mindest Temperatur: ". minValue($temp)."<br>";
echo "Maximal Temperatur: ". maxValue($temp)."<br>";
echo "Durchschnittstemperatur: ". number_format(($count / $total), 2, ".") ."<br>";

function minValue($array){
if (empty($array)) {
return null;
}

$kleinsterWert = $array[0];

foreach ($array as $wert) {
if ($wert < $kleinsterWert) {
$kleinsterWert = $wert;
}
}
return $kleinsterWert;
}

function maxValue($array){
if (empty($array)) {
return null;
}

$kleinsterWert = $array[0];

foreach ($array as $wert) {
if ($wert > $kleinsterWert) {
$kleinsterWert = $wert;
}
}
return $kleinsterWert;
}

?>

</body>
</html>

0 comments on commit 497e81a

Please sign in to comment.