Python編寫求1?
Python編寫1+2+3+······+n的值代碼如下:遞歸求和
n = int(input())
jie = 1
sum = 0
i = 1
while n >= i:
jie = jie * i
sum = sum + jie
i = i + 1
print(sum)
Python編寫求1?
Python編寫1+2+3+······+n的值代碼如下:遞歸求和
n = int(input())
jie = 1
sum = 0
i = 1
while n >= i:
jie = jie * i
sum = sum + jie
i = i + 1
print(sum)