Please help me find my mistake with this question my code has been provided below

package challenge;

import java.util.Scanner;

public class c1 {

public static void main(String[] args) {
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int val = 1;
	int nst = 1;
	// row
	int row = 1;
	while (row <= n) {
		if(row<=n/2) {
			val=1;
		}
		else {
			val=n-row;
	}
		// star wrk
		for (int cst = 1; cst <= nst; cst++) {
			if (cst == 1|| cst == nst) {
				System.out.print(val);
			} else {
				System.out.print("0");
			}

		}
		row = row++;
	}
	// preparation
System.out.print("\n");
	
	nst = nst + 1;
	row = row + 1;


}

}

the error is in first if clause .Make it simple .print first two lines seperately and rest of the lines will work by your for loop.

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.