Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment#5c++ Write a program in c++ that neatly displays the first 21 numbers

ID: 3686007 • Letter: A

Question

Assignment#5c++

Write a program in c++ that neatly displays the first 21 numbers in the Fibonacci sequence in a table. Recall the definition for the Fibonacci sequence:

F0 = 0

F1 = 1

F2 = 1

Fn = Fn- 1 + Fn - 2

The program should calculate the numbers in the sequence using two different functions. In one display, use an iterative function and in the other use a recursive strategy. The driver code in main should do no calculations; instead, it should just draw the tables and populate them with well-formed calls to the two functions you write. Your functions should take a single integer argument and return the value of the appropriate term in the Fibonacci sequence using the argument as an index. For example Fibonacci(5) should return 5 because 5 is the fifth term in the Fibonacci sequence (it is really the 6th, but zero counts). Fibonacci(7) should return 13 because 13 is the 7th term in the Fibonacci sequence. Start your program with the following shell:

// INCLUDES AND NAMESPACES

#include <iostream>

#include <iomanip>

using namespace std;

// PROTOTYPES

int FibonacciIterative(int);

int FibonacciRecursive(int);

// MAIN

int main() {

int i = 0;

// YOUR DRIVER CODE GOES HERE

return 0;

}

// FUNCTION IMPLEMENTATIONS

// returns F_i of the Fibonacci sequence (iterative)

int FibonacciIterative(int i) {

// YOUR ITERATIVE IMPLEMENTATION GOES HERE

}

// returns F_i of the Fibonacci sequence (recursive)

int FibonacciRecursive(int i) {

// YOUR RECURSIVE IMPLEMENTATION GOES HERE

}

clusersimarkieldesktop work stuff spr09cis 221 (01)1b weekly assignments project folders (solu... LETS LOOK AT THE FIBONACCI SEQUENCE.. ELEMENT ITERATIUE RECURSIUE 8 13 21 34 8 13 21 34 12 13 14 15 16 17 18 19 20 Press any key to continue 89 144 233 377 610 987 1597 2584 4181 6765 89 144 233 377 610 987 1597 2584 4181 6765

Explanation / Answer

#include using namespace std; long long FibonacciElement1(long long); long long FibonacciElement2(long long); int main(void) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote