programming-examples/c++/Basic/Pattern 4.cpp

27 lines
450 B
C++
Raw Normal View History

2019-11-18 14:44:36 +01:00
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr(); //clears the previous screen
//Printing pattern
int i,j,rows;
cout<<"Enter the number of rows: ";
cin>>rows;
for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
cout<<j<<" ";
}
cout<<"\n";
}
getch(); // wait for input
}
/*
1
12
123
1234
12345
*/