Aim :- Write a C++ Program To Print Following Pattern.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
C++ Program Code :
#include <conio.h>
#include <iostream.h>
void main()
{
int n;
clrscr();
cout<<"Enter n : ";
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
cout<<i;
cout<<"\n";
}
}
getch();
}
Output :
0 Comments