public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int i=1,nst=1,ns=n-1, val;
while(i<=n) {
val=1;
int cs=1;
while(cs<=ns) {
System.out.print("\t");
cs++;
}
int cst=1;
while(cst<=nst) {
System.out.print(val+"\t");
cst++;
if (cst<= nst / 2)
val++;
else
val--;
}
nst=nst+2;
ns--;
i++;
System.out.println();
}
}}
result:
5
1
1 0 -1
1 2 1 0 -1
1 2 3 2 1 0 -1
1 2 3 4 3 2 1 0 -1