Program to display the following pattern: 1 222 33333 4444444 555555555

Write a C++ Program to Display the Following Pattern.



/* Program to display the following pattern:
    1
   222
  33333
 4444444
555555555
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
for(int i=1,l=4,m=1;i<=9;i+=2,l--,m++)
{
for(int j=1;j<=l;j++)
cout<<" ";
for(int k=1;k<=i;k++)
cout<<m;
cout<<endl;
}
getch();
}


Learn More :