code used for console input