Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Fibonacci sequence is a series of numbers where a number is found by adding up the two numbers before it. The sequence goes 1,

The Fibonacci sequence is a series of numbers where a number is found by adding up the two numbers before it. The sequence goes 1, 1, 2, 3, 5, 8, 13, 21, 34, and so forth. Written as a rule, the expression is xn = xn-1 + xn-2.

We can compute the first 10 numbers in the sequence as follows:

F1 = 1

F2 = 1

F3 = F2 + F1= 1+1 = 2

F4 = F3 + F2= 2+1 = 3

F5 = F4 + F3= 3+2 = 5

F6 = F5 + F4= 5+3 = 8

F7 = F6 + F5= 8+5 = 13

F8 = F7 + F6= 13+8 = 21

F9 = F8 + F7= 21+13 = 34

F10 = F9 + F8 = 34+21 = 55

Write a program that will ask the user how many numbers from the Fibonacci sequence theyd like to see (should work for any value, not just for 10!).

Sample output:

How many values of the Fibonacci sequence would you like to see?

The first 7 values are: 1 1 2 3 5 8 13

writ it in java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago