Regarding input in challenge

when trying to provide an input to the code it generates error but if the inout is predefined code is working properly so, please help
The statement I am using for the input is
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();

and the error generated is
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)

this type of error occurs when your program is expecting input and no value is being provided…if your program takes a single input integer make sure that you provide it in the custom input box

Hey Kush,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.