NZEC Error:

I am new to programming. I am stuck with NZEC error.
When i compile it locally it works fine. But in Codechef editor it gives me runtime error (NZEC). After introcing try catch block it gave me this error:


Someone, please help me to resolve this issue.

import java.util.;
import java.lang.

class Main {
public static void main(String[] args)throws java.lang.Exception {
Scanner obj = new Scanner(;
int n = obj.nextInt();
int val;
while(n-- > 0){
val = obj.nextInt();
int result = 1;
for(int i=1;i<=val;i++)
result = result * i;
}catch(java.lang.Throwable t){

Usually NoSuchElementException comes when you are not giving that much input as your code wants(means if you are giving 5 integers as input but while code executes it requires more than 5 input than this occur) and also when you are giving string as input but your run time input has to be integer.