PROGRAM TO PRINT A PATTERN – 4

/*PROGRAM TO PRINT A PATTERN – 4*/

#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(in odd numbers): “;

cin>>n;

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

count=n+2;

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

{

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

{

cout<<j<<”  “;

}

count=count-2;

cout<<endl;

}

}

void main()

{

pattern p1;

clrscr();

p1.process();

getch();

}

Leave a Reply

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