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) ); } }

23rd Aug 2020, 4:14 PM
Halisa Nur
Halisa Nur - avatar
2 ответов
+ 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.
23rd Aug 2020, 4:17 PM
RKK
RKK - avatar
+ 1
And actually return statement condition, I think is return fib(n-1) + fib( n-2); Only, if it is Fibonacci code.
23rd Aug 2020, 4:24 PM
Jayakrishna 🇮🇳