Uploaded new units

This commit is contained in:
2023-11-30 09:16:02 +01:00
parent 52cdef645c
commit 9c8f8a9fbf
4 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,35 @@
#include <iostream>
using namespace std;
int main() {
// Variablendeklaration
int x, y, z;
// Eingabe
cout << "Bitte geben Sie x ein: ";
cin >> x;
// Variableninitialisierung
y = 3;
z = x * y;
// Berechnung
while (x > 0) {
y += 2;
z--;
if (z > 3) {
z -= 2;
} else {
z += 2;
}
x--;
}
// Ausgabe
cout << "x = " << x << endl;
cout << "y = " << y << endl;
cout << "z = " << z << endl;
}