Calculate the factorial of a given number recursively and non-recursively.