The following is a code snippet representing the Fibonacci number:
It will return a -1 for any numbers less than 0.Code:int fibonacci(int value) { if (value < 0) { return -1; } else if (value == 0) { return 0; } else if (value < 2) { return 1; } else { return fibonacci(value - 1) + fibonacci(value - 2); } }