Code is working at my machine but not online at your IDE

This code works in my machine. However, it is showing as wrong in online IDE. I used your IDE and it showed a complication error.

How to move forward with it?

I can get the required pattern using this code. Please see it once.

@sinuscoupon0s_4659768f9d9b587e Mistakes that you have made in this code is :
i) import.java.util.Scanner;
ii) Use Double quotes in SysO. Line no. 19 and 35 should contain double space not single bcoz online judge will check each and every space. So Use double. quotes and give double spaces here like :
System.out.print(" “);
iii) Add a single space after printing val in SysO Line no. 23,28,39 and 47 Like :
System.out.print(val+” ");
iv) When n = 1 your code is giving :
1 1
but correct output is : 1
So add a if statement for n == 1 and when it is true just print 1 and nothing else.
Corrected code : https://ide.codingblocks.com/s/675578?_ga=2.89493531.1496026746.1665294903-1929680183.1664090385

The corrected code in the link is still giving an error. Could you help me submit the code and test it

@sinuscoupon0s_4659768f9d9b587e You have edited the code once again to the previous code and you have not solved the problems that I mentioned. below is corrected Code(Passing all test cases) :

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        	// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);

		// defining initial values
		int n = scn.nextInt();
		int nsp1 = n - 1; // space before digits
		int nsp2 = -1;// space between digits
		int nst = 1;
		int val = 1;

		// work using for loop

		if(n == 1)
		System.out.println(1);
		else{
			for (int rows = 1; rows <= n; rows++) {
			for (int csp = 1; csp <= nsp1; csp++) {
				System.out.print("  ");
			}

			if (rows == 1) {
				System.out.print(val+" ");
			}

			if (rows > 1 && rows < n) {
				for (int cst = 1; cst <= nst; cst++) {
					System.out.print(val+" ");
					if (val > 1) {
						val--;
					}
				}

				for (int csp = 1; csp <= nsp2; csp++) {
					System.out.print("  ");
				}

				for (int cst = 1; cst <= nst; cst++) {
					System.out.print(val+" ");
					if (cst != nst) {
						val++;
					}
				}
			}

			if (rows == n) {
				System.out.print(val+" ");
			}

			// preparation

			System.out.println();
			if (rows <= n / 2) {
				nsp1 -= 2;
				nsp2 += 2;
				val++;
				nst += 1;
			} else {
				nsp1 += 2;
				nsp2 -= 2;
				val--;
				nst -= 1;
			}

		}
		}
		scn.close();
    }
}

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.