SIR I HAVE WRITTEN THE EXACT CODE AS IN THE VIDEO, BUT THE OUTPUT IS DIFFERENT. KINDLY CHECK

Scanner sc= new Scanner(System.in);
System.out.println(“ENTER VALUE OF N”);
int n= sc.nextInt();
int nr= 2n-1;
int nst= 1;
int row=1;
while(row<=nr) {
//work
int cst=1;
while(cst<=nst) {
System.out.println("
");
cst++;
}
//preparation
System.out.println();
if (row<=nr/2)
{
nst=nst+1;}
else {
nst=nst-1;
}
row=row+1;

	}
}
}

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.