在这里插入代码片
#include<stdio.h>
int main(void) {
int i, n,x1,x2,x3 ;
scanf("%d",&n);
x1 = 1;
x2 = 1;
if(n == 1) {
printf("%d ",x1);
}
if(n == 2) {
printf("%d %d ",x1,x2);
} else {
printf("%d %d ",x1,x2);
for(i = 1; i <= n; i++) {
x3 = x2 + x1;
printf("%d ",x3);
x1 = x2;
x2 = x3;
}
}
return 0;
}
来源:CSDN
作者:一条河可以
链接:https://blog.csdn.net/weixin_45949073/article/details/103811901