0
Can someone show me what wrong with my code
include <stdio.h> int fib(int f); int main() { int a; scanf ("%d",&a); printf ("enter a numbe\n"); printf ("fac of %d is %d\n",a, fib (a) ); return 0; } int fib (int f) { if (f == 1 || f == 0) { return 1; } else { return ( fib(f)*(f-1)+fib(f)*(f-2) ); } }
2 Antworten
+ 2
it's #include(with #) and not just include.
I think its
return f * fib(f-1);
Only, if it is Factorial of a number code.
+ 1
And actually return statement condition, I think is
return fib(n-1) + fib( n-2);
Only, if it is Fibonacci code.