keymasterviriya1150

Untitled

Jan 28th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int N;
  6.     cin>>N;
  7.     int temp=N+2;
  8.     for (int i = 1; i <= N; i++) //Run line
  9.     {
  10.         for(int k=1;k<i;k++ )
  11.             cout<<"  ";
  12.         for (int j = 1; j<= temp; j++)// Run number
  13.         {
  14.  
  15.             cout<<i<<" ";
  16.         }
  17.         cout<<"\n";
  18.         temp=temp-2;
  19.         if(temp==0)
  20.             temp=1;
  21.         else if(temp==-1)
  22.             temp=1;
  23.     }
  24. }
Add Comment
Please, Sign In to add comment