Need Help with debug Non Recursive (iterative) Fibonacci repo: to an external site. points: 10 Write a program that uses a for loop to calculate a Fibona

STUCK with your assignment? When is it due? Hire our professional essay experts who are available online 24/7 for an essay paper written to a high standard at a reasonable price.

Order a Similar Paper Order a Different Paper

Need Help with debug

Non Recursive (iterative) Fibonaccirepo: to an external site. points: 10Write a program that uses a for loop to calculate a Fibonacci sequence (NOT RECURSIVE!!!) up to a given position, starting with position 0. This function defines a Fibonacci sequence:

  • If the number is 0, the function returns a 0
  • If the number is 1, the function returns a 1
  • If the number is higher than 1, it returns the sum of the previous two numbers

The output should look something like this — user inputs are in bold blue type: How many elements do you want to display (starting with 0)? 18 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597 Thank you!

You must use the repo from the link from each assignment to start and submit your work. You must include the standard header and comments in your source code for all of your files that you submit. Compile, run, and test your program. Make sure there are no errors and it functions properly. You can hit [Ctrl or command]+[Shift]+B to compile and run the program. Your program must run without errors to get full credit! Assignments that do not compile will not be graded. Commit and push (upload) your repo, including all of your program source files to the base directory of the repo in GitHub for grading. Files must be named correctly and saved as a readable files with the proper extension. You must follow any given input/output constraints to get full credit for your work. I will not accept any programs that use prefix notation for incrementing or non-specific data types (like var and auto). Programs must adhere to common formatting conventions for the programming language you are using.

//start c++

#include <iostream>using namespace std;int main(){    int count, n;    cout<< “How many elements do you want to display (starting with 0)?” << endl;     cin >> count;    int *array = new int[count];    array[0]=0;    array[1]=1;    for (n=2; n<count;n++)       {             array[n] = array[n-1] + array [n-2];       }        for (n=0; n<count;n++)        {        cout << array[n]<< ” ” << endl;        cout << “Thank You!” << endl;         return 0;        }}

Everyone needs a little help with academic work from time to time. Hire the best essay writing professionals working for us today!

Get a 15% discount for your first order

Order a Similar Paper Order a Different Paper