hi all, anyone see anything wrong with this? it prints out the days but the population or rather the fib calculation does not function.
Code:
#include <stdio.h>
#define MAX_LIMIT 10000000
long fib( long );
int main()
{
int day;
for( day = 1; (fib(day) < MAX_LIMIT); day++ )
printf( "day:%d\t population:%ld\n", day, fib(day));
return 0;
}
long fib( long num )
{
int n;
if (n == 0)
return 0;
else if ( n == 1 )
return 1;
else
return fib(n-1) + fib(n-2);
}