Please see the code and if possible tell why the test cases are failing

public static void main(String[]args) {
	
	
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
	int ns = n;
	int nst = 0;
	int row= 1;
	while(row<=n) {
		int val =1;
		for(int i =1;i<=ns;i++) {
			System.out.print(val);
			val++;
		}
		for(int j = 1;j<nst;j++) {
			System.out.print("* ");
		}
		System.out.println();
		ns--;
		nst+=2;
		row++;
	}