Skip to content

Commit 7fc55e9

Browse files
committed
factoria of a given number
1 parent 6f1718e commit 7fc55e9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

factorial.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__author__ = 'Avinash'
2+
3+
num = int(input("Enter a number: "))
4+
factorial = 1
5+
if num < 0:
6+
print("Please enter a positive integer")
7+
elif num == 0:
8+
print("The factorial of 0 is 1")
9+
else:
10+
for i in range(1, num + 1):
11+
factorial *= i
12+
print("The factorial of", num, "is", factorial)

0 commit comments

Comments
 (0)