From bc642a1aa8c39f8b3c3a219f48d47cbf17a21945 Mon Sep 17 00:00:00 2001 From: Ambareesh V Sankaran <49059311+Ambareeshvs@users.noreply.github.com> Date: Mon, 19 Oct 2020 16:40:56 +0530 Subject: [PATCH] Finding factorial of a number using python --- Python Programs/factorial.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Python Programs/factorial.py diff --git a/Python Programs/factorial.py b/Python Programs/factorial.py new file mode 100644 index 0000000..d793644 --- /dev/null +++ b/Python Programs/factorial.py @@ -0,0 +1,10 @@ +n = int(input("Enter the limit:")) +fact = 1 +if (n == 0): + print("Factorial is 1") +elif (n < 0): + print("Can't find the factorial") +else: + for i in range(1,n+1): + fact = fact * i + print("The factorial of",n,"is ",fact) \ No newline at end of file