Question: In C++ Write a program in CodeBlocks which stores the simplest Fibonacci Series in an array and then prints out the array. The Fibonacci Series
In C++
Write a program in CodeBlocks which stores the "simplest" Fibonacci Series in an array and then prints out the array.
"The Fibonacci Series is a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc." - Google Dictionary
Download the following CodeBlocks program "template" and enter your code after each corresponding comment.
FibonacciSeries.zip
This question is worth 50 points. Points will be added for correctly completing each of the required components. 10 points will be deducted from your score on this question if the program does not compile, 5 points will be deducted if the program runs incorrectly, and up to 5 points maybe deducted if any of the comments are removed from the downloaded main.cpp file.
Points are awarded for executing, in order, code for the following:
5 points : Declare an array of 100 "unsigned long long"s
5 points: Initialize the first element of the array to "0"
5 points: Initialize the second element of the array to "1"
10 points: Create a "while" loop. During each iteration of the loop, starting with the third element in the array, set each element to the sum of the values of the previous 2 elements. Loop until a value for all 100 element of the array have been calculated.
5 points: Querry the user for an index from which to start printing the series. Read in the users response and store the value into a short variable you declare.
5 points: Query the user for an index at which to stop printing the series. Read in the users response and store the value into a short variable you declare.
5 points: If the user enters asks to stop printing the series beyond index 93 print and error message.
10 points: ...else, use a for loop to print each number in the series starting with the index specified by the user and ending with the index specified by the user.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
