https://www.codechef.com/submit/FLOW001

import java.util.Scanner;
import java.lang.*;
public class Main
{
public static void main(String[] args)
{

        Scanner sc = new Scanner(System.in);
        int testcase = sc.nextInt();
    for(int i=0;i<testcase;i++)
    {
        int a = sc.nextInt();
        int b= sc.nextInt();
        add(a,b);
    }
    sc.close();
    }

   static void add(int a,int b)
    {
        int sum=0;
        sum=a+b;
        System.out.println(sum);
    }

}

This is my code.It’s a simple addition code but I’m still getting an error.The code works perfectly fine on my Intellij but here the NZEC error occurs.
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)

Please do help if you know how to remove this error

Did you put something in the Custom Input box or not while testing? I see that you are new to codechef and there is a tickbox for providing custom input which you must check and then put a sample input for your program. For example:

3
1 2
100 200
10 40

The above should yield a printed output of this:

3
300
50

Once your code gets this, you may click the submit button to check if your response is correct…

It worked.Thanks.
I’m actually used to codeforces so there if you press submit it works but here it seems that we have to check it before submitting.

Okay cool, no problem!