FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonprogram/factorial at master · zainabcodeplay/pythonprogram · GitHub
zainabcodeplay
pythonprogram
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonprogram
/
factorial
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (15 loc) · 287 Bytes
Breadcrumbs
pythonprogram
/
factorial
Copy path
File metadata and controls
16 lines (15 loc) · 287 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def factorial(n):
if n < 0:
return 0
elif n == 0 or n == 1:
return 1
else:
fact = 1
while(n > 1):
fact *= n
n -= 1
return fact
# Driver Code
num = 5;
print("Factorial of",num,"is",
factorial(num))
Back
|
FazBrowse Home
|
New Git URL