斐波那契数列

master
p5tblxgmk 3 years ago
parent 10809ae7fd
commit ed9ccfaf28

@ -0,0 +1,17 @@
#include<stdio.h>
long Fib(int n)
{
if(n == 0)
return 0;
if(n == 1)
return 1;
else
return Fib(n - 1)+Fib(n - 2);
}
int main()
{
int n=0;
scanf("%d",&n);
printf("%d\n",Fib(n));
return 0;
}
Loading…
Cancel
Save