Reading input data with the while statement