Just to add to his reply, You were resetting the variables smallest and largest every time you asked, which just meant that they were going to take the value of the what ever was input last and...