edited factorial method to get user input