#include
using namespace std;
int main(){
int n;
cin >> n;
int row, col , no;
// Upper Half
for (row = 1; row <=(n+1)/2; row++){
for (col = 1; col<=(4*(n-row)-12); col ++){
cout << ' ';
}
no = row;
for (col = 1; col<=row; col ++){
cout << no << ' ';
no = no - 1;
}
for (col = 1; col<=(4*row - 6); col ++){
cout << ' ';
}
no = 1;
if (row != 1){
for (col = 1; col <= row; col ++){
cout << no << ' ';
no = no + 1;
}
}
cout << endl;
}
// Lower Half
for (row = (n+1)/2 - 1 ; row>=1; row --){
for (col = 1; col<=(4*(n-row)-12); col ++){
cout << ' ';
}
no = row;
for (col = 1; col<=row; col ++){
cout << no << ' ';
no = no - 1;
}
for (col = 1; col<=(4*row - 6); col ++){
cout << ' ';
}
no = 1;
if (row != 1){
for (col = 1; col <= row; col ++){
cout << no << ' ';
no = no + 1;
}
}
cout << endl;
}
return 0;
}
of upper half by using above statement