Hello,
I am trying to do a recursive function using fiboncci. I have been working on this and it is not working.
#include "stdafx.h"
#include "stdio.h"
int fib (int n); // function prototype//
int main (void)
{
int num, result;
printf ("Please enter a positive integer\n");
scanf ("%d", &num);
result= fib (num);
return (0);
}
int fib (int n)
{
int old_number= 0;
int current_number = 1;
int next_number;
}
if ((n == 0) || (n == 1)) // stopping cases
return 1;
else // recursive case
return fib(n - 1) + fib(n - 2);
}