The fibonacci numbers are defines by the sequence f 1 = 1 f 2 =1 f n = f n-1 +f
ID: 3617014 • Letter: T
Question
The fibonacci numbers are defines by the sequencef1= 1 f2=1 fn= fn-1+fn-2
Reformulate that as
fold1 = 1 fold2 = 1 fnew = fold1 +fold2
after that discard fold2 which is no longer needed andset fold2 to fold1 and fold1 to fnew an appropriate number oftimes.
Implement a program that computes the fibonacci numbersin that way.
I have no idea what the heck this text book question fromc++ for everyone is asking for please help me steps would be muchappreciated will rate lifesaver!
f1= 1 f2=1 fn= fn-1+fn-2
Reformulate that as
fold1 = 1 fold2 = 1 fnew = fold1 +fold2
after that discard fold2 which is no longer needed andset fold2 to fold1 and fold1 to fnew an appropriate number oftimes.
Implement a program that computes the fibonacci numbersin that way.
I have no idea what the heck this text book question fromc++ for everyone is asking for please help me steps would be muchappreciated will rate lifesaver!
Reformulate that as
fold1 = 1 fold2 = 1 fnew = fold1 +fold2
after that discard fold2 which is no longer needed andset fold2 to fold1 and fold1 to fnew an appropriate number oftimes.
Implement a program that computes the fibonacci numbersin that way.
I have no idea what the heck this text book question fromc++ for everyone is asking for please help me steps would be muchappreciated will rate lifesaver!
Explanation / Answer
#include using namespace std; /* recursive function for calculating Fibonacci(n) */ int T(int n) { if (n==1) return 1; // fold1 =1 else if (n==2) return 1; //fold2 =1 else return T(n-1) + T(n-2);//this calculate fnew =fold1 +fold2 } int main() { int number; coutnumber; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.