How to compare two integer passwords using array

UKHeliBob:
You should also check whether what is returned is between '0' and '9' in case the user presses another key.

I should use a switch statement for that?
Another problem. The Program doesn't wait for me to input the characters. It starts printing access denied as soon as I receive the otp. What do I do?
Can I use another key such as the '#' or '*' as an Enter key or is it not required?