diff --git a/Maths/Factorial/factorial.py b/Maths/Factorial/factorial.py new file mode 100644 index 0000000..249c7e7 --- /dev/null +++ b/Maths/Factorial/factorial.py @@ -0,0 +1,13 @@ +fc = 1 + +def factorial(num, fc): + if num < 0: + print("Can't calculate the factorial of a negative number :/") + elif num == 0: + print("0! = 1") + else: + for i in range(1, num + 1): + fc = fc * i + print(f"{num}! = {fc}") + +factorial(0, fc) # Number to make the factorial