Skip to content

Commit

Permalink
Merge pull request #78 from alhassanv/master
Browse files Browse the repository at this point in the history
feat: create factorial.py
  • Loading branch information
fineanmol authored Oct 16, 2020
2 parents bba565c + 07d4896 commit a739ccd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Program's_Contributed_By_Contributors/factorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
num = int(input("Enter a number: "))

factorial = 1

if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1, num + 1):
factorial = factorial * i
print("The factorial of", num, "is", factorial)

0 comments on commit a739ccd

Please sign in to comment.