Whats is the error in this . Compiler is Showing Error on Scanner

import java.util.*;

public class Main {

public static void main(String args[]) {

	
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		System.out.println(1);

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

				if(j==0 || j==i){
					System.out.print(i);
				
				}else{
					System.out.print("0");
				}
			}
			System.out.println();
		}

		
}

}

@amankumar7017,
Your code is correct. What error are you getting while submission?

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:9)

this is error which i mentioned above also

@amankumar7017,
Your code is correct and should submit. You can refresh the browser and try again. Also, you can drop an email to [email protected] regarding the technical problem you are facing

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.