#include <stdio.h>
//1,1,2,3,5,8,13这个数列叫斐波那契数列,
//编程实现第N个数的值
int feibonaqie(int n)
{
if(n==1||n==2)
{
return 1;
}
else
{
return feibonaqie(n-2)+feibonaqie(n-1);
}
}
int main(int argc, char *argv[])
{
printf("%d\n",feibonaqie(6));
printf("Hello World!\n");
return 0;
}
斐波那契数列
最新推荐文章于 2024-09-06 18:25:49 发布