You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Function/斐波那契数列.cpp

18 lines
215 B

#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;
}