PROGRAM TO PRINT THE FOLLOWING PATTERN
1
22
333
4444
55555
:
#include<iostream>
using namespace std;
class pattern
{
int i,j;
public:
void patt()
{
for(i=1;i<6;i++)
{for(j=1;j<=i;j++)
cout<<i;
cout<<"\n";
}
}
};
main()
{pattern p;
p.patt();
}
1
22
333
4444
55555
:
#include<iostream>
using namespace std;
class pattern
{
int i,j;
public:
void patt()
{
for(i=1;i<6;i++)
{for(j=1;j<=i;j++)
cout<<i;
cout<<"\n";
}
}
};
main()
{pattern p;
p.patt();
}