From a1df8a458fa814c3a096185ffeac79119e6b6d92 Mon Sep 17 00:00:00 2001 From: danielvici123 <94993276+danielvici@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:08:33 +0200 Subject: [PATCH] prog aufgabe vom --- progp/24-10-24/bmi.php | 146 +++++++++++++++++++++++++++++++++++++++ progp/24-10-24/while.php | 36 ++++++++++ 2 files changed, 182 insertions(+) create mode 100644 progp/24-10-24/bmi.php create mode 100644 progp/24-10-24/while.php diff --git a/progp/24-10-24/bmi.php b/progp/24-10-24/bmi.php new file mode 100644 index 0000000..1ff248a --- /dev/null +++ b/progp/24-10-24/bmi.php @@ -0,0 +1,146 @@ + + + + + + BMI Rechner + + + + +
+

BMI-EINGABE FORMULAR

+
+ (in cm) + + + +
+ +
+ KEINE ZAHL ANGEBEN


"; + } else { + echo "

BMI - Berechnungsergebnisse

"; + echo "Körpergröße: ".$groesse." cm

"; + + while ($gewicht < 190){ + $bmi = $gewicht / (($groesse/100) ** 2); + $bmi_rounded = round($bmi, 2); + + // Bestimme die BMI-Kategorie + if ($bmi < 18.5) { + $class = "orange"; // untergewichtig + $label = "Untergewicht"; + } elseif ($bmi >= 18.5 && $bmi < 25) { + $class = "green"; // normalgewicht + $label = "Normalgewicht"; + } else { + $class = "red"; // übergewichtig + $label = "Übergewicht"; + } + + // Zeige das Ergebnis mit entsprechender Farbe + echo "
Gewicht: ".$gewicht." kg -> BMI: ".$bmi_rounded." (".$label.")

"; + $i++; + $gewicht +=10; + } + } + ?> +
+
+ + + diff --git a/progp/24-10-24/while.php b/progp/24-10-24/while.php new file mode 100644 index 0000000..1d2272b --- /dev/null +++ b/progp/24-10-24/while.php @@ -0,0 +1,36 @@ + + + + + + Document + + + "; + echo "------------------
"; + $i = 0; + $nr = 0; + + echo "WHILE 1:
"; + while ($i<10){ + echo $i."
"; + $i++; + + } + echo "------------------
"; + echo "WHILE 2:
"; + while ($i>10){ + echo $i."
"; + $i--; + + } + echo "------------------
"; + echo "WHILE 3 (AUFGABE):
"; + while ($nr<100){ + $nr++; + echo $nr.". Ich darf im Unterricht nicht schwätzen
"; + } + ?> + + \ No newline at end of file