第5章 循环结构程序设计

第5章 循环结构程序设计 例5.8:求Fibonacci(斐波那契)数列的前四十个数。这个数列有如下特点:第1,2两个数为1,1.从第三个数开始,该数是其前面两个数之和。即该数列为1,1,2,3,5,8,13,…,用数学方式表示为F1=1(n=1);F2=1(n=2);Fn=Fn-1+Fn-2 (n>=3) #include <stdio.h> int main() { int f1=1,f2=1
相关文章
相关标签/搜索