Pattern hourglass 1

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<=(2
n)+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…

(2n) is not defined, it will be 2*n

And you have not incremented you value for ‘row’ anywhere so your program is going into an infinite loop.

What is the purpose of this statement? You have to print double space here