# define _CRT_SECURE_NO_WARNINGS 1
# include <stdio.h>
int fun(int x)
{
if (x == 1)
return 1;
else if (x == 2)
return 1;
else
return fun(x-2) + fun(x-1);
}
int main(void)
{
int x = 0;
scanf("%d", &x);
int n = fun(x);
printf("%d", n);
return 0;
}
递归计算斐波那契数列
最新推荐文章于 2024-08-22 17:27:46 发布