Compare commits

...

1 Commits

Author SHA1 Message Date
p35p4k9vx 3aa43efa57 蒋婷湘
1 year ago

@ -0,0 +1,24 @@
#include<stdio.h>
int fibonacci(int n)
{
if(n<=1)
return 1;
return fibonacci(n-1)+fibonacci(n-2);
}
int main()
{
int n,x;
printf("请输入你想要得到的项:");
scanf("%d",&n);
int i;
for(i=0;i<=n;i++)
{
x=fibonacci(i);
printf("第%d个斐波那契数为%d\n",i,x);
}
return 0;
}
Loading…
Cancel
Save