Random Pattern

07:55 0 Comments A+ a-

Problem:
Write a program that takes size from user a displays the following pattern:

Sample Run 1:

Solution:
# include <iostream>
using namespace std;
int main()
{
int size;
int j;
int temp;
cout<<"Please enter the size of pattern : ";
cin>>size;
temp=size;
for(int i=0;i<size;i++)
{
j=1;
while (j<=temp)
{
cout<<j<<" ";
j++;
}
cout<<endl;
temp--;

}

return 0;

}