Intel Corporation interview question

How would you make a recursive fibonacci sequence in c++?

Interview Answer

Anonymous

5 Nov 2015

int fib(int x) { if (x == 0) return 0; if (x == 1) return 1; return fib(x-1)+fib(x-2); }

1