0

how it work return (f(n-1)+f(n-2));

#include<stdio.h> int f(int n); int main() { int n,i=0,c; scanf("%d",&n); printf("fib\n"); for(c=1;c<=n;c++){ printf("%d\n",f(i)); i++; } return 0; } int f(int n) { if(n==0 || n ==1) return n; else return (f(n-1)+f(n-2)); }

16th Sep 2019, 12:04 AM
Ahmed Waheed Alhaddad
Ahmed Waheed Alhaddad - avatar
2 Answers
0
Thank you
20th Sep 2019, 3:14 AM
Ahmed Waheed Alhaddad
Ahmed Waheed Alhaddad - avatar