Aufgabe 24-11-06 (PROGP)
This commit is contained in:
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -4,4 +4,8 @@
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="WokwiProjectSettings">
|
||||
<option name="wokwiConfigPath" value="INF\wokwi\wokwi.toml" />
|
||||
<option name="wokwiDiagramPath" value="INF\wokwi\test\diagramm.json" />
|
||||
</component>
|
||||
</project>
|
||||
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -3,7 +3,6 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/schule-24-25.iml" filepath="$PROJECT_DIR$/.idea/schule-24-25.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/schule-24-26.iml" filepath="$PROJECT_DIR$/.idea/schule-24-26.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
56
progp/24-11-6/schleifen.php
Normal file
56
progp/24-11-6/schleifen.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Kontrollstrukturen: Schleifen</h1>
|
||||
<?php
|
||||
|
||||
echo "<h2>For-Schleife (kopfgesteuerte Schleifen)</h2>";
|
||||
|
||||
// for(Startwert, Wiederholbedingung (mit Endwert), Schrittweite)
|
||||
for ($i = 0; $i < 10; $i++) { // Schleifen Kopf
|
||||
echo "Zahl: $i<br>"; // Schleifen Rumpf
|
||||
}
|
||||
|
||||
echo "========================<br>";
|
||||
|
||||
for ($i = 10; $i >= 0; $i--) {
|
||||
echo "Zahl: $i<br>";
|
||||
}
|
||||
|
||||
echo "========================<br>";
|
||||
|
||||
for ($i = 0; $i < 10; $i += 20) {
|
||||
echo "Zahl: $i<br>";
|
||||
}
|
||||
|
||||
echo "<h2>While-Schleifen (kopfgesteuerte Schleifen)</h2>";
|
||||
|
||||
$i = 1; // Startwert
|
||||
while($i <= 10) { // Schleifen Kopf mit Wiederholbedingung(Endwert)
|
||||
echo "Zahl: $i<br>"; // <- Schleifen Rumpf
|
||||
$i++; // Schrittweite
|
||||
}
|
||||
|
||||
echo "========================<br>";
|
||||
|
||||
$i = 10;
|
||||
while ($i >= 1) {
|
||||
echo "Zahl: $i<br>";
|
||||
$i--;
|
||||
}
|
||||
|
||||
echo "========================<br>";
|
||||
|
||||
$i = -100;
|
||||
while ($i <= 100) {
|
||||
echo "Zahl: $i<br>";
|
||||
$i+=20;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
29
progp/24-11-6/ueb1_schleifen.php
Normal file
29
progp/24-11-6/ueb1_schleifen.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$summe = 0;
|
||||
echo "<p>Schleife 10</p>";
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$summe += $i;
|
||||
}
|
||||
echo "<p>Summe: $summe</p>";
|
||||
echo "<p>Schleife 100</p>";
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
$summe += $i;
|
||||
}
|
||||
echo "<p>Summe: $summe</p>";
|
||||
echo "<p>Schleife 1000</p>";
|
||||
for ($i = 1; $i <= 1000; $i++) {
|
||||
$summe += $i;
|
||||
}
|
||||
echo "<p>Summe: $summe</p>";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user