implement factorial in c