What does your code do when it gets the invalid input? It should loop back and ask the user to the number to process.
Look at your code and see why it is not looping back. How does it fall out of the loop when there is invalid input?
Can you write a small program that will compile and execute with only this problem in it and post it here?