C语言算法--费式数列

#include <stdio.h>

int fibonacci(int n);

int main(int argc, char const *argv[])

{

/* code */

printf("input your month:");

int month =0;

scanf("%d",&month);

int number = fibonacci(month);

printf("rabbit number = %d\n",number );

return 0;

}

int fibonacci(int n){


if(n == 0 || n == 1){

return 1;

}else{

return fibonacci(n-1)+fibonacci(n-2);

}

}


你可能感兴趣的:(return,C语言,number,include,rabbit)