Write a Program to print an Inverted Pyramid 

C++// C++ Program to print inverted pyramid #include <iostream> using namespace std; int main() { int rows = 5; for (int i = rows; i >= 1; i--) { for (int j = rows; j > i; j--) { cout << " "; } for (int k = 1; k <= (2 * i - 1); k++) { cout << "*"; } cout << endl; } return 0; }

Output

*********
 *******
  *****
   ***
    *

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *