Signup/Sign In

C++ Program To Print Flip Pattern Of Half Pyramid Using *

Here our task is to print the required pattern without actually writing it manually. We will see how to do this for a half pyramid pattern. The simplest case will be to make the pattern using * only.

Program to print the Flip pattern of Half Pyramid using *

?
#include <iostream>
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
* * * * *
* * * *
* * *
* *
*

Conclusion

As for the implementation part, we can use alphabets, or any other symbol for the pattern but the general will remain the same for always.