[Solved] UVa 562 runtime error. What can I do? [closed]


I have solved it.

The problem was NoSuchElementException for the line:
n=scanner.nextInt();
I have fixed it using:

if(scanner.hasNextInt()) 
{
   n = scanner.nextInt();
}

The code has been accepted by uHunt.

solved UVa 562 runtime error. What can I do? [closed]