My program gives an exception in java thread main

Pattern inverted hour glass program run on my laptop ide(eclipse) but can not compile in these challenge ide.
Gives an exception .My code is
Scanner sc = new Scanner(System.in);
System.out.println(“ENTER A VALUE Of N”);
int n = sc.nextInt();
int nr = 2n+1;
int nst = 1;
int nsp = 2
n-1;
int var;
int row=1;
while(row<=nr){
var=n;
for(int cst=1; cst<=nst;cst++){
System.out.print(var);
var–;
}
for(int csp=1; csp<=nsp;csp++){
System.out.print(" ");
}
int cst =1;
if(row==nr/2+1){
cst=2;
var++;
}
var++;
for(; cst<=nst;cst++){
System.out.print(var);
var++;
}
System.out.println();
if(row<=nr/2){
nsp=nsp-2;
nst++;
}else{
nsp=nsp+2;
nst–;
}

		row++;
	}

@shardul15 Bro I have picked your submission, its working for me, check if you are submitting correct code, the only problem is you haven’t added spaces, its mentioned in the problem.

@A17CRX0016 after spacing also give error

@shardul15 Bro what error you are facing attach ss, because I have submitted your code only, make sure you keep the class name as Main while submitting!

@A17CRX0016 this error
Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:5)

@shardul15 Bro custom input daala hai? Wo daalo! Ide pr

@A17CRX0016 thanks bro

@shardul15 Bro resolve it and rate full!