Site icon KSoftLabs

Calculating Factorial Using Recursion

Python Tutorial by KSoftLabs.com

 

def fact(num):
    if num==1:
        return 1
    else:
        return num*fact(num-1)

print(fact(int(input("Please enter the number : "))))

 

 

Exit mobile version