Added while loop

Added a while loop to validate the users input in the prompt, still
problem as infinite loop is created when enter invalid number.