Write a program to display the following pyramid structure using for loop.
5
44
333
2222
11111
#include <iostream>
using namespace std;
int main(){
int a = 5;
while (a > 0){
int b = 5;
while (b >= a){
cout
<< a;
b--;
}
cout
<< endl;
a--;
}
system("pause");
return 0;
}
Comments
Post a Comment