Prime Visit Submission

I have written solution for the given problem below but it saying NoSuchElementException error. But I am not been able to understand why this error is occuring. Below I am pasting my solution to the code.

import java.util.;
public class Main {
public static void main(String args[]) {
primeVisit();
}
public static void primeVisit()
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0)
{
int a= sc.nextInt();
int b = sc.nextInt();
int result = findPrime(a,b);
System.out.println(result);
}
}
public static int findPrime(int a, int b)
{
int result = 0;
for(int i=a;i<=b;i++)
{
for(int j=2;j
j<=i;j++)
{
if(i%j==0)
{
result++;
}
}
}
return result;
}
}

hey @rupesh21
Please Give custom input