# Factorial of a Number def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) num = int(input("Enter a number: ")) print("The factorial of", num, "is", factorial(num))
Output:
Enter a number: 5
The factorial of 5 is 120
# Factorial of a Number def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) num = int(input("Enter a number: ")) print("The factorial of", num, "is", factorial(num))
Output:
Enter a number: 5
The factorial of 5 is 120
+91-8400061384
support@ithunt.org