def factorial_loop(n):
    f = 1
    if n==0:
        return f
    else:
        i = 1
        while(i<=n):
            f = f*i
            i = i+1
        return f
def factorial(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n*factorial(n-1)

print(factorial_loop(5))
print(factorial(5))
