Please tell my mistake in logic of programme


my logic for the given pattern is

Scanner scn = new Scanner(System.in);
int n=scn.nextInt();
int nsp=n-1;
int nst=1;
// row work
int row=1;
while(row<=n) {
for(int csp=1; csp<=nsp;csp++) {
System.out.print(" “);
}
for(int cst=1; cst<=nst; cst++) {
System.out.print(”*"+"\t");
}
System.out.println();
nsp=nsp-1;
nst=nst+2;
row=row+1;

Hi @vshivendra0,you are incrementing nst by 2 but see in every row nst are increasing by 1,so correct there by writing nst=nst+1

even after changing that it is giving wrong out put.
. would you please tell my mistake my code for this pattern is

Scanner scn = new Scanner(System.in);
int n=scn.nextInt();
int nsp=n-1;
int nst=1;
// row work
int row=1;
while(row<=n) {
for(int csp=1; csp<=nsp;csp++) {
System.out.print(" “);
}
for(int cst=1; cst<=nst; cst++) {
System.out.print(”*"+"\t");
}
System.out.println();
nsp=nsp-1;
nst=nst+1;
row=row+1;

}

}
}

Your error is coming due to uneven spaces.I have made the required changes in the code,you can check here.Rest of the code is completely fine.
https://ide.codingblocks.com/s/69415