Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

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

Need Help with debug

Non Recursive (iterative) Fibonaccirepo: https://classroom.github.com/a/etQ5AcLgLinks 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;        }} 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question