Compiled with no error but no output. please help

import java.util.*;
public class Main {
public static void main(String args[]) {

	Scanner scn = new Scanner(System.in);
	//System.out.println("enter no. of rows");
	int n = scn.nextInt();

	int nst = 1;

	// rows
	int row = 1;
	while (row <= n) {
		// work
	
		if (row % 2 == 0) {
			int cst = 1;
			while (cst <= nst) {
				if (cst == 1 || cst == row) {
					System.out.print("1");
				} else {
					System.out.print("0");
				}
				cst++;
			}
		} else {
			int cst = 1;
			while (cst <= nst) {
				System.out.print("1");
			}
		}

		// preparation
		System.out.println();
		row = row + 1;
		nst = nst + 1;
	}

}

}

@Yuganshu,

https://ide.codingblocks.com/s/224724 corrected code.

you missed cst++; in one loop. I have highlighted the error line.

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.