You are viewing a single comment's thread. Return to all comments →
c language (easy)
int fibo(int num) { if(num==0||num==1) return num; else return fibo(num-1)+fibo(num-2);
} int main() { int n; scanf("%d",&n); printf("%d",fibo(n)); return 0; }
Recursion: Fibonacci Numbers
You are viewing a single comment's thread. Return to all comments →
c language (easy)
include
int fibo(int num) { if(num==0||num==1) return num; else return fibo(num-1)+fibo(num-2);
} int main() { int n; scanf("%d",&n); printf("%d",fibo(n)); return 0; }