fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int rows;
  7. cout << "Enter the number of rows for the Inverted Half Pyramid: ";
  8. cin >> rows;
  9.  
  10. for (int i = rows; i >= 1; --i) {
  11. // Print stars
  12. for (int j = 1; j <= i; ++j) {
  13. cout << "* ";
  14. }
  15. cout << endl;
  16. }
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5268KB
stdin
4
stdout
Enter the number of rows for the Inverted Half Pyramid: * * * * 
* * * 
* * 
*