Try this one
int fib(int n)
{
int x, a, b;
x = 1; a = 1; b = 0;
while( x <= n )
{
int temp = a+b;
b = a;
a = temp;
x = x+1;
}
return a;
}
fib(n)
=