NoSuchElementException


#1

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 Codechef.main(Main.java:33)
code is:
public static void main(String[] args) throws java.lang.Exception {
Scanner s=new Scanner(System.in);
int tc=s.nextInt();//error in this line
while(tc>0) {
tc–;
if(s.hasNextInt()) {
int N=s.nextInt();
improve(N);
}

	}
}

}


#2

are u using codechef ide?
if yes then enter inputs in custom input area