fork download
#include <iostream>

using namespace std;

int main() {
    int rows;
    cout << "Enter the number of rows for the Inverted Half Pyramid: ";
    cin >> rows;

    for (int i = rows; i >= 1; --i) {
        // Print stars
        for (int j = 1; j <= i; ++j) {
            cout << "* ";
        }
        cout << endl;
    }

    return 0;
}
Success #stdin #stdout 0.01s 5268KB
stdin
4
stdout
Enter the number of rows for the Inverted Half Pyramid: * * * * 
* * * 
* * 
*