subject

The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
The next number is found by adding up the two numbers before it.
For example, the 2 is found by adding the two numbers before it (1+1). The 3 is found by adding the two numbers before it (1+2). The 5 is found by adding the two numbers before it (2+3), and so on! Each number in the sequence is called a term.
In this exercise, you will need to:
Create the array int[] sequence that holds the values of the first 15 terms of the Fibonacci sequence. Think carefully about what happens to the index when iterating through the loop to fill this array. Read the Fibonacci description above to help!
Then print out the sequence of numbers seperated by a space.
Finally, create a method findIndex to find the index of the term 55.
Sample output:
Fibonacci sequence up to 15 terms:
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
Index position of 55 is: 10
Hint: You will need to use several loops: One to fill the array, one to print the array, and one to traverse the array!
Below is the coding given to change. Please use a template:
public class Fibonacci
{
public static void main(String[] args)
{
//number of elements to generate in the sequence
int max = 15;
// create the array to hold the sequence of Fibonacci numbers
//create the first 2 Fibonacci sequence elements
sequence[0] = 0;
sequence[1] = 1;
//create the Fibonacci sequence and store it in int[] sequence
//print the Fibonacci sequence numbers
System. out. println("\nIndex position of 55 is: " + findIndex(sequence, 55));
}
// This method finds the index of an element in an array
public static int findIndex (int[] arr, int n)
{
// your code goes here
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
question
Computers and Technology, 24.06.2019 03:00
What is one potential problem associated with an organization purchasing new technology early in its lifecycle
Answers: 1
You know the right answer?
The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
The nex...
Questions
question
History, 20.02.2021 02:50