Pattern Question

Hi I have put following code for the above question:

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
if (n>0) {
m1(n);
}
}
public static void m1(int n){
System.out.println(“1”);
int row = 1;
int nst = 2;
int nsp = 0;
while(row<=n-1){
//star work
System.out.print(row);
//space work
for (int csp=1; csp<=nsp; csp++){
System.out.print(“0”);
}
//star work
System.out.print(row);
//prep
System.out.println();
row++;
nst++;
nsp++;
}

}

}

When I run with the given test cases they print the proper pattern. But my submission failed.
Please help me understand the error with my logic.
The pattern is below:

hey @a08mitra
try for this
input : 1
your code gives : 1 then line changes
but correct output : 1 (line changes nhi krna h )

Thank you Sir for the solution