/** Excercise: * Trace through this program to see how a * while loop behave and how the variables * change throughout the duration of the loop. * * The Fibonacci number sequence: * 1, 1, 2, 3, 5, 8, 13, 21, 34... */ void main(){ int fib; fib = fibonacci(8); printf("fib: %d\n", fib); } // find the nth fibonacci number int fibonacci(int n){ int a = 1; int b = 1; int i = 3; int c; while( i <= n ){ c = a + b; a = b; b = c; i = i + 1; } return b; }