PROGRAM TO PRINT A PATTERN – 1

/*PROGRAM TO PRINT A PATTERN – 1*/

#include<conio.h>

#include<iostream.h>

class pattern

{

int i,n,j;

public:

void input();

void display();

};

void pattern::input()

{

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

cin>>n;

}

void pattern::display()

{

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

{

for(j=i;j>=1;j–)

cout<<j<<” “;

cout<<endl;

}

}

void main()

{

pattern p1;

clrscr();

p1.input();

p1.display();

getch();

}

Leave a Reply

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