def fei(N):
if N<=0:
return 0
if N==1:
return 1
return fei(N-1)+fei(N-2)
a=int(input())
for i in range(1,a+1):
print(fei(i),end=" ")
```
斐波纳契数列(python)
最新推荐文章于 2024-09-07 20:08:36 发布
def fei(N):
if N<=0:
return 0
if N==1:
return 1
return fei(N-1)+fei(N-2)
a=int(input())
for i in range(1,a+1):
print(fei(i),end=" ")
```