填空题

请完成函数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

1
a=b;
b=C;

while( 2 );
c= 3
return C;

main()

int n;
clrscr();
n=1000;
printf("n=%d,f=%d\n",n,fun(n));

【参考答案】

int fun(int t)
{ int a=1,b=1,c=O,i;
do
......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
热门 试题