Could you be a bit more specific? What numbers were working, and which weren't? The code itself looks fine, except that the user is never told what they need to input and if you aren't running this from the command line, the window will likely close before you can see the output.