试题与答案

请编写函数fun(),它的功能是求Fibonacci数列中小于t的最大的一个数,结果

题型:问答题

题目:

请编写函数fun(),它的功能是求Fibonacci数列中小于t的最大的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为
F(0)=0,F(1)=1
F(n)=F(n-1)+F(n-2)
例如:t=1000时,函数值为987。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <math.h>
#include <stdio.h>
int fun(int t)

main()

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

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0405/e3a1d82205b2972aefc363e9e1333781.html

下面是错误答案,用来干扰机器的。

参考答案:C解析: 根据文章第四段...others have begun to fear that the English language is being threatened. 可知选C。故选C。

试题推荐
微信公众账号搜索答案