Created the 1st solution_2.cpp
This commit is contained in:
parent
30cd6ed9e1
commit
a82301cc5b
22
units/2023_10_19/solution_2.cpp
Normal file
22
units/2023_10_19/solution_2.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
// Variablen deklarieren
|
||||||
|
int length, width;
|
||||||
|
|
||||||
|
// Benutzer nach Laenge und Breite fragen
|
||||||
|
cout << "Geben Sie die Laenge (in cm) ein: ";
|
||||||
|
cin >> length;
|
||||||
|
|
||||||
|
cout << "Geben Sie die Breite (in cm) ein: ";
|
||||||
|
cin >> width;
|
||||||
|
|
||||||
|
int perimeter = 2 * (length + width);
|
||||||
|
int area = length * width;
|
||||||
|
|
||||||
|
// Ergebnis ausgeben
|
||||||
|
cout << "Der Umfang betraegt " << perimeter << " cm." << endl;
|
||||||
|
cout << "Die Flaeche betraegt " << area << " qcm.." << endl;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user