Using a while loop to find the averagre