标签:... int stdio.h ++ 技术 include span AC image
1 //输出Fibonacci数列1,1,2,3,5,8,13,21,...的前40项 2 //经过观察,我们可以得出结论后一项是前两项之和 3 #include <stdio.h> 4 int main(){ 5 int a,b,c; 6 a=1; 7 b=1; 8 c=a+b; 9 int sum=a; 10 for(int i=1;i<5;i++){ 11 a=b; 12 b=c; 13 c=a+b; 14 sum+=a; 15 } 16 printf("%d\n",sum); 17 return 0; 18 }
标签:... int stdio.h ++ 技术 include span AC image
原文地址:https://www.cnblogs.com/Tobi/p/9219774.html