C语言递归函数实现斐波那契数列计算
#include <stdio.h> #include <stdlib.h> int f(int n); int main() { int n; scanf("%d",&n); printf("%d",f(n)); return 0; } int f(int n) { if(n==0 || n==1) return 1; else return f(n-1)+f(n-2); }
原文地址: https://www.cveoy.top/t/topic/nYU9 著作权归作者所有。请勿转载和采集!