xxxxxxxxxx
def facto(n):
f = 1
if n > 1:
for i in range(2,n+1):
f = f*i
return f
print(facto(5))
xxxxxxxxxx
def facto(n):
f = 1
if n > 1:
f = n*facto(n-1)
return f
print(facto(5))
2 1 |
1 | 1 | ||||
1 | 2 | 1 | |||
1 | 3 | 3 | 1 | ||
1 | 4 | ... | ... | 1 | |
1 | ... | ... | ... | ... | ... |
1 | 1 | ||||
1 | 2 | 1 | |||
1 | 3 | 3 | 1 | ||
1 | 4 | 6 | 4 | 1 | |
1 | 5 | 10 | 10 | 5 | 1 |
3 1 |
4 0 |
1 0 |
1 3 |
1 1 |
0 1 |
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.
|
1 2 |
|
|
|
|
|
.
|
0 2 |
2 2 |