read a num until meet end then display it