CODING JOY

The stunning potpourri of coding and mundane life

SPLIT PYRAMID PATTERN IN C++ LANGUAGE



AMRUHA AHMED
10th October,2023.



This article will aid you in the creation of a split pyramid pattern in C++ language using a combination of nested loops.

blog1

DELVING DEEPER:

BREAK-UP OF THE PATTERN:

blog1

PROGRAM:

                
                    #include<iostream>
                    using namespace std;
                    int main()
                    {
                        int s=7;//number of spaces to be printed
                        int i,j;//loop counters
                        for(i=1;i<=7;i++)
                        {
                            for(j=1;j<=s;j++)
                            {
                                cout<<"  ";
                            }
                            for(j=1;j<=i;j++)
                            {
                                cout<<"* ";
                            }
                            cout<<" ";
                            for(j=1;j<=i;j++)
                            {
                               cout<<"* ";
                            }
                            cout<<"\n";
                            s--;
                        }
                        return 0;
                       
                    }
                    
                    
             
         
CODE COPIED

OUTPUT:

blog1