⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prog69.c

📁 c题库
💻 C
字号:
/*
请编写函数fun,它的功能时:求Fibonacci数列中大于t的最小的一个数,结果有函数返回。其中Fibonacci数列F(n)的定义为:
        F(0)=0, F(1)=1
        F(n)=F(n-1)+F(n-2)
  例如:当t=1000时,函数值为1597。
  注意:部分源程序给出如下。
  请勿改动主函数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));
}

/*
答案:
	int  a=1,b=1,c=0,i;
	for(i=4;i<=t;i++)
	{	if(c<t)
		{ c=a+b;
			a=b;
			b=c;
		}
		else break;
	}
	return c;
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -