import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int val=n;
int nsp=0;
int nst=(2n)+1;
int row=1;
while(row<=(2n)+1)
{
int csp=1;
while(csp<=nsp)
{ System.out.print(" “+” ");
csp++;
}
int cst=1;
while(cst<=nst)
{
System.out.print(val+" ");
if(cst<=nst/2)
val--;
else
val++;
cst++;
}
if(row<=n)
val=val-2;
System.out.println();
if(row<=n+1)
{
nsp++;
nst=nst-2;
}
else
{
nsp--;
nst=nst+2;
}
}
}
}
what is problem in code,only half of pattern is printing when i run this on hackerblocks,and showing error when i tried in ide.codingblocks…