PATTERN 23 DOUBT

why are we not using space code again after the stars code like we have used previously ?

Scanner scn= new Scanner(System.in);
int n= scn.nextInt();
int nsp=n-1;
int nst=1;
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(“1”);
}for(int csp=1;csp<=nsp;csp++) {
System.out.print(” ");
}System.out.println();
nst=nst+2;
nsp–;
row++;
}
}
}

Hey @adityakathoch_a87e00c5c7e39b2d It depends on the pattern we are forming according to that the position of space loop or stars loop might change there is no specific reason for that.

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.