week 10 lianxi

来源:互联网 发布:每日股市分析 知乎 编辑:程序博客网 时间:2024/05/21 17:50
/*fibonacci de 35th de value*/
/* Note:Your choice is C IDE */#include "stdio.h"#define a 35long   fibonacci(int n);main(){   printf("%d de value is %ld",a,fibonacci(a)); }long  fibonacci(int n){ if (n>2)return fibonacci(n-1)+fibonacci(n-2);else return 1;}

/*用递归求8的阶乘*/
/* Note:Your choice is C IDE */#include "stdio.h"long dou(int n);main(){  printf("%d de jiecheng is %ld\n",8,dou(8));    }long dou(int n){ long ans;if(n>1)ans=n*dou(n-1);elseans=1;return ans; }

0 0
原创粉丝点击