マガジンのカバー画像

Algorithm

5
運営しているクリエイター

#factorial

Factorial with recursion

Ever wonder how recursion works in code? Imagine when you are given 6!, you first multiply the next integer factorial in sequence (6! = 6*5!). You repeat the process until 0 is reached. This works the same way in programming. Just think of