I have submitted the code with correct output but it is showing error

Scanner scn = new Scanner(System.in);
int n = scn.nextInt();

	int row=1;

	int nr = 2*n +1;
	int nst = 2*n +1;
	int nsp = 0;
	int val = n;
	while(row<=nr) {
		for(int csp = 1;csp<=nsp;csp++) {
			System.out.print(" ");
		}
		for(int cst = 1;cst<=nst;cst++) {
			System.out.print(val);
			if(cst<=nst/2) {
				val--;
			}
			else {
				val++;
				
			}
			
		}
		System.out.println();
		if(row<=nr/2) {
			nst-=2;
			nsp++;
			val-=2;
		}
		else {
			nst+=2;
			nsp--;
			
		}
		row++;
		
	}

Hey @pulkitgupta622 You have not submitted the code with correct output. Difference in spaces you can clearly see below :
image This is your output.

This is correct output.

Look for difference between spaces.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.