This is in Delphi (Object Pascal) but you should get the idea. Bascially, declare the phone number as an integer, then trap the exception that would occur if they enter a character.
If you want to go back up so they have to enter it again, just use a label.
writeln('Enter Customer Phone Number:');
writeln('Oops, you enter something other than 0-9');