top of page
Click here to go to the home page of AskTheCode.

Calculate the factorial of a number using recursion.

Asked: Anonymously |Category: Python

n=eval(input("Enter The number"))

def factorial (n):

if n==1:

return 1

return n*factorial(n-1)

print(factorial(n))

Recent Posts

See All

Comments


bottom of page