Manmohan loves pattern error

code:

import java.util.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner scn=new Scanner(System.in);
int n= scn.nextInt();
int nst=1;
int row=1;
while(row<=n)
{
if(row%2==0 && row>=4)
{
System.out.print(“1”);
for(int cst=1;cst<=nst-2;cst++)
{
System.out.print(“0”);
}

			System.out.print("1");
		}
		else
		{
			for(int csp=1;csp<=nst;csp++)
			{
				System.out.print("1");
			}
		}
	}
		
		nst++;
		System.out.println();
		row++;
}

}

error is:

infinte loop of 1 as output

@preet25.pc
Your while is going in an infinite loop because you are placing the incrementing condition of the loop (row++) outside the while.
Please add these inside the while,rest is correct.

	nst++;
	System.out.println();
	row++;

I hope i have cleared your doubt please mark it acknowledged else ask further doubts on this problem here.

it shows time limit…is there any other solution to this problem r compilation prob

okay…it is done…thanks