Ok, I initially wrote a simple code to return the Fibonacci number from the series based on the user input..
n=5 will produce 3..
static int fibonacci(in
The right way to do it is use accumlator.
the code should look something like this (i didn't check it, it's only the idea)
static int fibonacci(int n, int accumlator) {
if (n == 1)
return 0;
else if (n == 2)
return 1;
else
accumlator = (fibonacci(n - 1, accumlator) + fibonacci(n - 2, accumlator));
return accumlator;
}