From daef5a97dc5635d4a899f03e26b258fedd523242 Mon Sep 17 00:00:00 2001 From: Avinash Magar Date: Tue, 2 Oct 2018 21:52:03 +0530 Subject: [PATCH] Add script for factorial. --- factorial/factorial.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 factorial/factorial.py diff --git a/factorial/factorial.py b/factorial/factorial.py new file mode 100644 index 0000000..e2eee69 --- /dev/null +++ b/factorial/factorial.py @@ -0,0 +1,14 @@ + +#function to calculate a factorial of provided number. +def fact(number): + factorial=1 + while number != 0: + factorial=factorial*number + number = number - 1 + return factorial + + +if __name__=="__main__": + number=int(input("Enter a number:")) + print("Factorial of provided number : ",fact(number)) +