Skip to content

Commit 172fcbf

Browse files
Create factorial.py
1 parent 39b515b commit 172fcbf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

factorial.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def factorial(n):
2+
3+
return 1 if (n==1 or n==0) else n * factorial(n - 1);
4+
5+
6+
num = int(input("Enter a number: "));
7+
8+
print("Factorial of",num,"is",factorial(num))

0 commit comments

Comments
 (0)