Write a program to display the following pyramid structure using do while loop. 1 21 321 4321 54321

 Write a program to display the following pyramid structure using do while loop. 

21 
321 
4321 
54321
# include <iostream>
using namespace std;
int main(){

       int a = 1;

      
       do{
             
               
              int b = 1;
              int c = a;

             
              do{
                    
                     cout << c;
                     c--;
                     b++;

              } while (b <= a);

              cout << endl;
              a++;
       } while (a <= 5);


       system("pause");
       return 0;
}


Comments