PROGRAM TO PRINT A PATTERN – 3

/*PROGRAM TO PRINT A PATTERN – 3*/

#include<conio.h>

#include<iostream.h>

class pattern

{

int i,j,n,count;

public:

void process();

};

void pattern::process()

{

cout<<“Enter the limit of rows: “;

cin>>n;

cout<<“\nPattern is:\n\n”;

count=1;

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++)

{

cout<<count<<”  “;

count++;

}

cout<<endl;

}

}

void main()

{

pattern p1;

clrscr();

p1.process();

getch();

}

Leave a Reply

Your email address will not be published. Required fields are marked *