You will need to repeat your call to strtol
inside your loops where you are asking the user to try again. In fact, if you make the loop a do { ... } while(...);
instead of while, you don't get a the same sort of repeat things twice behaviour.
You should also format your code so that it's possible to see where the code is inside a loop and not.