Factorial of Number ( Recursive Method )

PHOTO EMBED

Tue Dec 20 2022 13:15:13 GMT+0000 (Coordinated Universal Time)

Saved by @sukumar #python

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

n=int(input('enter number:'))
if n<0:
    print('enter positive number')
else:
    print(n,'!=',fact(n))
    
content_copyCOPY