added recursion and while loops for factorial