# This is Iterative method
# def factorial(n):
# f = 1
# for i in range(n):
# f = f * (i+1)
# return f
# a = int(input("Enter the no: "))
# print(factorial(a))
# This s recursion method
def factorial(n):
if n==1:
return 1
else:
return n*factorial(n-1)
a = int(input("Enter the no: "))
print(factorial(a))
Comments
Post a Comment