Error in Fibonacci Pattern(pattern4)

This is my code:
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();

	int num1=0;
	int num2=1;

	int row=1;
	while(row<=n){
		for(int cst=1;cst<=row;cst++){
			int f;
			System.out.print( num1 +"\t");
			f = num1;
			num1=num2;
			num2 = num2+f;
			cst++;
			
		}
		row++;
	}
}

}

On compilation it shows the error:

Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:5)

I used the scanner the same way in all the pattern related lectures. How do i resolve this error?

@Raunak-Agrawal-1537545869717573,

https://ide.codingblocks.com/s/233581 corrected code. you are doing cst++ twice. Also use nst instead of n in the for loop.

I edited the code according to your suggestion but the CB IDE shows the same error:
Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:7)

The code ran successfully on eclipse.

@Raunak-Agrawal-1537545869717573,
did you submit the code I sent you? Its the same code I have added nst as the variable and commented the errors.

Yeah the problem is resolved, thanks.