Display Following Pattern

09:19 0 Comments A+ a-

Problem:
Write a program that takes size from user a displays the following pattern:
Sample Run 1:
Enter Size: 3
Output:
1 2 3
1 2
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;

}