programming-examples/c++/_Basic/Pattern 1.cpp
2019-11-15 12:59:38 +01:00

18 lines
417 B
C++

#include <iostream.h>
#include <conio.h>
void main()
{
clrscr(); //clears the previous screen
//Printing first pattern (Floyds triangle)
int rows,i,j,k=0;
cout<<"Enter number of rows: ";
cin>>rows;
for(i=1; i<=rows; i++)
{
for(j=1; j<=i; ++j)
cout<<k+j<<" ";
++k;
cout<<endl;
}
getch(); // wait for input
}