Write a program to display the following pyramid structure using while loop.
1
12
123
1234
12345
#include <iostream>
using namespace std;
int main(){
int a = 1;
while (a <= 5){
int b = 1;
while (b <= a){
cout
<< b;
b++;
}
cout
<<endl;
a++;
}
system("pause");
return 0;
}
Comments
Post a Comment