Skip to main content

Palindromic Pattern

 /* @ToDo 


   Palindromic Pattern
                1   
            2   1   2   
        3   2   1   2   3   
    4   3   2   1   2   3   4   
5   4   3   2   1   2   3   4   5   
   
*/


#include <iostream>
using namespace std;

int main(){
     #ifndef ONLINE_JUDGE
        freopen("../asset/input.txt","r",stdin);
        freopen("../asset/output.txt","w",stdout);
    #endif
    // Code here!!

   int ncin>>n;
   for(int i=1;i<=n;i++){
        for(int j=0;j<n-i;j++)
            cout<<"\t";
        int j=i;
        for(;j>1;j--)
            cout<<j<<"\t";        

        for(;j<=i;j++)
            cout<<j<<"\t";
        cout<<endl;
   }

    return 0;
}

Comments

Subscribe to Get's Answer by Email