write a pseudocodes for the two c++ program’s below and execute them in a LaTeX overleaf.

1) fibonacci_Iterative_
#include <iostream>using namespace std;
int fib(int maxFib){
long curr, currMinus2 = 1, currMinus1 = 1; cout << “nfib 1 = ” << currMinus2 << endl; cout << “fib 2 = ” << currMinus1 << endl;
for (int i = 3; i <= maxFib; i++){ curr = currMinus2 + currMinus1; cout << “fib ” << i << ” = ” << curr << endl; currMinus2 = currMinus1; currMinus1 = curr; } return curr;}int main(){ int myElement = 0; long myResult;
while (myElement < 3){ cout << “nPlease enter an integer greater than 2: “; cin >> myElement; }
myResult = fib(myElement);
cout << “nnResult = ” << myResult << endl; return 0;}

2) fibonacci_recursive_

// Recursive solution for calculating the fibonacci series// From HackerRank video
#include <iostream>using namespace std;
long fib(long n) { if (n <= 0) { return 0; } else if (n==1) { return 1; } else { return fib(n-1) + fib(n-2); }}
int main(){ long fibResult = fib(15); // Higher than 45 will be an exponentially long wait cout << “nResult = ” << fibResult << endl; return 0;}

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount! Use Discount Code “Newclient” for a 15% Discount!NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

The post briefly explained below 1 appeared first on Custom Nursing Help.

 

"Is this question part of your assignment? We Can Help!"

Essay Writing Service