How is 5th row working?

i wrote the code for this pattern it has 9 rows i.e( n=5) using for loop and it is working .
i get it that how it is working for each row except for row no 5, could you tell me how it is working for row no 5 ?

as i think it should print 4 asterisks in row 5 as row no 5 will fall in else block and it should print 9-5=4 asterisks , but instead it is printing 5 asterisk

here is the code

int n = scn.nextInt();

	int casp=n*2-1;
	for(int i=1; i<=casp;i++) {
		if(i<=casp/2) {

for(int j=1;j<=i;j++) {

			System.out.print("* ");
		}
		} else { 
			for(int k=i;k<=casp;k++) {
				System.out.print("* ");
				}
			}
		
		System.out.println();
	}

@arreyvikkytu
in the else loop we are printing from 5 to 9 so the number of element printed will be
9-5+1=5 , you get it now if you still have some doubt feel free to ask.

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.