作业帮 > 综合 > 作业

编写函数fun,它的功能是:求Fibonacci数列中大于t的最小的一个数,结果c语言编写函数fun,它的功能是:求Fi

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/04/30 06:31:41
编写函数fun,它的功能是:求Fibonacci数列中大于t的最小的一个数,结果c语言编写函数fun,它的功能是:求Fibo
其中Fibonacci数列F(n)的定义为:
F(0)=0,F(1)=1
F(n)=F(n-1)+F(n-2)
例如:当t = 1000时,函数值为:1597.
#include
#include
int fun( int t)
{ ____1_____
do {
继续写出该函数体语句
} while(f3 < t) ;
____2_____
}
main() /* 主函数 */
{ int n;
n=1000;
printf("n = %d,f = %d\n",n,fun(n));
}
编写函数fun,它的功能是:求Fibonacci数列中大于t的最小的一个数,结果c语言编写函数fun,它的功能是:求Fi
1.int f1=0,f2=1,f3;
2.return f3;
继续写:f3=f1+f2;
f2=f3;
f1=f2;