Von neuman loves binary

able to solve the challenge but not sure how to provide custom input throwing
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:13)

code used

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

Scanner scanner =new Scanner(System.in);

	int number=scanner.nextInt();
	for(int i=1;i<=number;i++)

	{
		Scanner scan =new Scanner(System.in);
		
		int n=scan.nextInt();
		int x=0;
		int y=0;
		int val=1;

//
while(n/10!=0||n%10!=0)
{
x=n%10;
n=n/10;
y=y+x*val;

			val=val*2;
		}
		
		System.out.println(y);	
	}
	

}

}

make only one scanner at top

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.