How to find Factorial of a Number using python

def factorial(n): if n == 0:return 1else:return n * factorial(n - 1)num = int(in

Created By :

Created On :

19-03-2024

How to find Factorial of a Number using python

Updated on 24, February 2024 293 Enrolled
how to

Step 1

def factorial(n):

if n == 0:

return 1

else:

return n * factorial(n - 1)

num = int(input("Enter a number: ")) print("Factorial:", factorial(num))

line

Copyrights © 2024 letsupdateskills All rights reserved