Program:
Output:
#factorial program using recursive function def fact(n): if(n==1): return 1 else: return(n*fact(n-1)) #recursive function call num=int(input("enter a number:")) if(num >= 1): print("Factorial of",num,"is",fact(num)) ''' 5*fact(4) 5*4*fact(3) 5*4*3*fact(2) 5*4*3*2*fact(1) 5*4*3*2*1=120 '''
Output: