#
# Recursive Factorial with accumulator
#
def fact(n, acc=1):
if n == 0:
print(n,end=" ")
return acc
else:
print(n,end=" ")
return fact(n-1, acc * n)
print(fact(5))
IwojIFJlY3Vyc2l2ZSBGYWN0b3JpYWwgd2l0aCBhY2N1bXVsYXRvcgojCmRlZiBmYWN0KG4sIGFjYz0xKToKCQoJaWYgbiA9PSAwOgoJCXByaW50KG4sZW5kPSIgIikKCQlyZXR1cm4gYWNjCgkJCgllbHNlOgoJCXByaW50KG4sZW5kPSIgIikKCQlyZXR1cm4gZmFjdChuLTEsIGFjYyAqIG4pCgpwcmludChmYWN0KDUpKQkJ