-------------------------------------------------
unsigned
int fibonacci( unsigned int
n )
{
unsigned
int i, last, next_to_last,
answer;
if(
n <= 1 )
return
1;
last
= next_to_last = 1;
for(
i = 2 ; i <= n ; i++)
{
answer
= last + next_to_last;
next_to_last
= last;
last
= answer;
}
return
answer;
}
-------------------------------------------------
|