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

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

54321 
4321 
321 
21 
1

# include <iostream>
using namespace std;
int main(){
       int a = 5;
       for (a; a >= 0;a--){
             
              int b = 1;
              int c = a;
              for (b; b <= a;b++){
                    
                     cout << c;
                     c--;
              }


              cout << endl;
       }



       system("pause");
       return 0;

}

Comments