C++ :: Aufgabe #275
3 Lösungen

Das kleine Einmaleins
Anfänger - C++
von DragStar
- 06.04.2020 um 08:32 Uhr
Erstellen Sie ein Programm, welches das kleine Einmaleins in der Form
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 ...
.
.
.
10 20 30 40 50 60 70 80 90 100
ausgibt.
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 ...
.
.
.
10 20 30 40 50 60 70 80 90 100
ausgibt.
Lösungen:

#include <iostream> #include <iomanip> using namespace std; int main() { cout << " |"; for (int i = 1; i < 11; i++) cout << setw(4) << i; cout << "\n"; cout << string(46, '-') << "\n";; for (int k = 1; k < 11; k++) { cout << setw(4) << k << " |"; for (int j = 1; j < 11; j++) cout << setw(4) << k*j; cout << "\n"; } }

#include <iostream> #include <iomanip> using namespace std; int main() { int aus; for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 10; j++) { cout << setw(4) << i * j; } cout << "\n"; } cin >> aus; }

#include <iostream> #include <iomanip> using namespace std; /* 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 */ int main(){ int i; int k; for(i=1; i<6; i++){ for(k=1; k<11; k++){ cout << setw(5) << i*k; } cout << endl; } }