Hey guys,
I'm supposed to write a program that will calculate the Nth fibonacci number, without using recursion.
I have the recursion problem written already, but am having a hard time doing the iterative one.
here's my recursion function:
int fib ( int n )
{
if ( n <= 1 )
return 1 ;
else
return ( fib ( n - 1 ) + ( fib ( n - 2 ) ) ) ;
}
any help with getting me started on the iterative one?