modified incorrect input into a loop

changed the if statements for incorrect entries to while statements