Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or prior classes. To briefly summarize, it is a sequence that is created when you repeatedly add the two prior numbers in the sequence together. Here is an example of the first few numbers in the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21… In CSE 1322L, we teach students how to create this sequence using an advanced concept called recursion. In this class however, we’ll use arrays and loops. Your task is to do the following: • Prompt the user to enter the length of the Fibonacci Sequence they want to make ◦ Validate that the number is greater than 0, and keep asking them until it is • Use that number to initialize an empty array ◦ C++ Students: Watch the video posted on the FYE website or D2L to learn how to do this in your language – it’s a little different from the Java and C# approach • Initialize index 0 of the array to 0, and index 1 of the array to 1. • Using a looping structure, fill the array with the correct Fibonacci sequence values • Once the array is full, use another looping structure to print the sequence from the array Note: You must store the sequence in the array, and then print it in a separate loop from the one that created it. You can not print the values in the same loop where you create and store them in the array. Sample Output #1: [Fibonacci Sequence Generator] How long should the Fibonacci Sequence be?: -15 Sequences must be larger than 0! How long should the Fibonacci Sequence be?: 5 Okay, here’s your sequence: 0, 1, 1, 2, 3

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Fibonacci Sequence. You may have learned about Fibonacci
Sequences in high school or prior classes. To briefly summarize, it is a sequence that is
created when you repeatedly add the two prior numbers in the sequence together. Here
is an example of the first few numbers in the sequence:
0, 1, 1, 2, 3, 5, 8, 13, 21…
In CSE 1322L, we teach students how to create this sequence using an advanced
concept called recursion. In this class however, we’ll use arrays and loops.
Your task is to do the following:
• Prompt the user to enter the length of the Fibonacci Sequence they want to make
◦ Validate that the number is greater than 0, and keep asking them until it is
• Use that number to initialize an empty array
◦ C++ Students: Watch the video posted on the FYE website or D2L to learn
how to do this in your language – it’s a little different from the Java and C#
approach
• Initialize index 0 of the array to 0, and index 1 of the array to 1.
• Using a looping structure, fill the array with the correct Fibonacci sequence
values
• Once the array is full, use another looping structure to print the sequence from
the array
Note: You must store the sequence in the array, and then print it in a separate loop from the one
that created it. You can not print the values in the same loop where you create and store them in the
array.
Sample Output #1:
[Fibonacci Sequence Generator]
How long should the Fibonacci Sequence be?: -15
Sequences must be larger than 0!
How long should the Fibonacci Sequence be?: 5
Okay, here’s your sequence:
0, 1, 1, 2, 3

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education