From 081ac212c4759f97b29185be9de8e2413e272ff7 Mon Sep 17 00:00:00 2001 From: Rithic Hariharan <60564768+gr8rithic@users.noreply.github.com> Date: Thu, 5 Oct 2023 00:30:30 +0530 Subject: [PATCH] Create factorialRecursive.py --- Python/factorialRecursive.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Python/factorialRecursive.py diff --git a/Python/factorialRecursive.py b/Python/factorialRecursive.py new file mode 100644 index 00000000..ca468226 --- /dev/null +++ b/Python/factorialRecursive.py @@ -0,0 +1,10 @@ +def factorial(number): + if number == 0: + return 1 + else: + return number * factorial(number - 1) + + +N = int(input("Enter N: ")) +result = factorial(N) +print(f"The factorial of {N} is {result}")