Write a program that prompts the user for a positive number
Solution
#include <iostream>
 using namespace std;
 int main()
 {
 int n,i,j,t; // \'n\' is for positive number , \'i\',\'j\' is for loop, \'t\' is temp variable
 cout << \"Enter the number of rows : \";
 cin>>n;
 if(n<1){
 cout<< \"Please enter positive number\" <<endl;
 return 0;
 }
 cout<<\"The number pattern is : \"<<endl;   
 for(i=0; i<n; i++){
 t=i;
 for(j=0; j<n; j++)
 {
 if(j == 0)
 {
 cout<<t<<\"\\t\";
 }
 else
 {
 t = t-1;
 cout<<abs(t)<<\"\\t\";
 }
 }
 cout<<endl;
 }
 return 0;
 }
Here\'s the explaination:
 * Prepare two loop, one for rows and one for columns
 * keep the row\'s number in temporary variable \'t\' and iterate the column\'s
 * In each column\'s iteration, check if its the first column then print the
 temp variable else decrement temp variable by 1 and prints its absolute value

