As you will see from Sebastian Janisch's reply, you have a subtle error in your assignment; fib(0) is not 1 but 0.
You should have fib(1) = 1 and fib(2) = 1 in the commonest Fibonacci series, and fib(10) = 55. work out why he has marked the method
static, which I believe is correct.
Note you can shorten SJ's solution to one statement and avoid two
returns in the same method:
return a == 1 || a == 2 ? 1 : fib(a - 1) + fib(a - 2);
It is possible to pass two parameters to a Fibonacci method and have it run in linear time, and it is possible to pass 4 parameters and run in logarithmic time (reference on
this thread), but I can't remember how to do it at the moment.