n=int(input("please input n: "))
x1=1
x2=1
count=2
print("{:>8}{:>8}".format(x1,x2),end="")
for i in range(3,n+1):
x3=x1+x2
print("{:>8}".format(x3),end="")
count+=1
if count%4==0:
print()
x1=x2
x2=x3
运行结果:
please input n: 10
1 1 2 3
5 8 13 21
34 55