未分类题

请完成函数fun( ),它的功能是:求Fibonacc数列中小于t的最大的一个数,结果由函数 0返回。Fibonacc数列F(n)定义为:
F(0)=0,F(1)=1
F(n)=F(n-1)+F(n-2)
例如:t=1000时,函数为987。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在下划线上填入所需的内容。
include<conio.h>
include<stdio.h>
include<math.h>
in fun(int t)
{
int a=l,b=1,c=0,i;
do
{
【 】;
a=b;
b=C;
}
while( 【 】);
c= 【 】;
return C;
}
main()
{
int n;
clrscr();
n=1000;
printf('n=%d,f=%d/n',n,fun(n));

A.h>
B.h>
C.h>


【参考答案】

int fun(int t) { int a=1b=1c=Oi; do { c=a+b; a=b; b=c; } whi......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)