Why is there an NoSuchElementException here?

public static void main(String args[]) {
// Your Code Here

	Scanner sc = new Scanner(System.in); 

int N = sc.nextInt();

int arr[] = new int[N];

System.out.println(“Enter total vals”);

for (int i = 0; i < N; i++) {

arr[i]=sc.nextInt();

}

boolean retval=isSOrt(N,arr);

System.out.println(retval);
}
}

Hi @rdadhich,
I guess you are trying to run the code so in order to run the code you will have to give custom input in the input box below …

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.