factorial and reverse programs work