Adobe Interview Question

How would you code a factorial function using no built in functions in R?