Programm zum Drucken einer halben Pyramide mit *
C++
xxxxxxxxxx
using namespace std;
int main()
{
int rows;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = 1; i <= rows; ++i)
{
for(int j = 1; j <= i; ++j)
{
cout << "* ";
}
cout << "\n";
}
return 0;
}
Enter number of rows: 5 * * * * * * * * * * * * * * *
Programm zum Drucken einer halben Pyramide mit Zahlen
C++
xxxxxxxxxx
using namespace std;
int main()
{
int rows;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = 1; i <= rows; ++i)
{
for(int j = 1; j <= i; ++j)
{
cout << j << " ";
}
cout << "\n";
}
return 0;
}
Enter number of rows: 5 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
Programm zum Drucken einer halben Pyramide mit Alphabeten
A B B C C C D D D D E E E E E
C++
xxxxxxxxxx
using namespace std;
int main()
{
char input, alphabet = 'A';
cout << "Enter the uppercase character you want to print in the last row: ";
cin >> input;
for(int i = 1; i <= (input-'A'+1); ++i)
{
for(int j = 1; j <= i; ++j)
{
cout << alphabet << " ";
}
++alphabet;
cout << endl;
}
return 0;
}
Umgekehrte Halbpyramide mit *
C++
xxxxxxxxxx
using namespace std;
int main()
{
int rows;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = rows; i >= 1; --i)
{
for(int j = 1; j <= i; ++j)
{
cout << "* ";
}
cout << endl;
}
return 0;
}
Enter number of rows: 5 * * * * * * * * * * * * * * *
Umgekehrte Halbpyramide mit Zahlen
C++
xxxxxxxxxx
using namespace std;
int main()
{
int rows;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = rows; i >= 1; --i)
{
for(int j = 1; j <= i; ++j)
{
cout << j << " ";
}
cout << endl;
}
return 0;
}
Enter number of rows: 5 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Linux - So installieren Sie anc-api-tools
Linux - So installieren Sie curvedns
Python - Überprüfen Sie, ob eine Zahl positiv, negativ oder 0 ist
Linux - So installieren Sie zenmap
C - Count Anzahl der Stellen in einer ganzen Zahl
C++ - Schaltjahr prüfen
JavaScript - Überprüfen Sie, ob eine Zeichenfolge mit bestimmten Zeichen beginnt und endet
C++ - Überprüfen Sie, ob eine Zahl eine Primzahl ist oder nicht
C - Finden Sie die größte Zahl mit dynamischer Speicherzuweisung
Kotlin - Runden Sie eine Zahl auf n Dezimalstellen
Kotlin - Eine Zahl umkehren
Linux - So installieren Sie xbitmaps
Linux - So installieren Sie zstd
Java - Eine Zahl umkehren
Linux - So installieren Sie zfs-test
Python - Schreiben von Excel (XLSX)-Dateien
C++ - Finden Sie Quotient und Rest
Linux - So installieren Sie zookeeper-bin
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month