C++ Online Compiler
Example: C++ program to print inverted half pyramid using Alphabets
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to print inverted half pyramid using Alphabets #include <iostream> using namespace std; int main() { int rows; char alphabet = 'A'; cout << "Enter the number of rows: "; cin >> rows; if (rows > 0) { cout << endl; for (int i = rows; i >= 1; i--) { for (int j = 1; j <= i; j++) cout << alphabet << " "; alphabet++; cout << endl; } } return 0; }
6
Output
Clear
ADVERTISEMENTS