The Fibonacci sequence is defined as the sequence that begins with 0 and 1, and every other number in the sequence is the sum of the two preceding numbers. Write a recursive method that computes the number in the Fibonacci sequence.

What will be an ideal response?


```
public int fibonacci(int n)
{
if(n == 1) return 0;
if(n == 2) return 1;
return fibonacci(n-1) + fibonacci(n-2);
}
```

Computer Science & Information Technology

You might also like to view...

Objects, or more precisely the that objects come from, are essentially reusable software components.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

________ are stored sets of instructions that automate common tasks

A) Macros B) Templates C) Adds-Ins D) ActiveX Controls

Computer Science & Information Technology

What is the best way to organize your files

A) Group them alphabetically B) Group them by file type C) Group them by how they relate to each other D) Group them by the date they were created

Computer Science & Information Technology

What is the maximum distance of a Class 3 Bluetooth device?

A. 100 meters B. 10 meters C. 1 meter D. 5 meters

Computer Science & Information Technology