from pip._vendor.distlib.compat
import raw_input
def fact(j):
total =
0
if j ==
0:
total =
1
else:
total = j * fact(j -
1)
return total
n = int(raw_input(
"请输入一个正整数:"))
for i
in range(
1,n+
1):
print (
'%d! = %d' % (i,fact(i)))
if i == n:
print(
'%d! = %d' % (i, fact(i)))
转载于:https://www.cnblogs.com/bilaisheng/p/10211057.html
相关资源:java 求任意一个正数的阶乘