Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
check if the number is negative, positive or zero
check if the number is negative, positive or zero
  • Loading branch information
vireshbangar authored Oct 5, 2020
commit a843f8a60c5eb7ab0bbeb008f8ca1c93c979a13b
8 changes: 8 additions & 0 deletions check if the number is negative, positive or zero
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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)