You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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
}