Question: Use a while - loop to complete the function. The best approach to implementing this function is to define two variables a and b ,

Use a while-loop to complete the function. The best approach to implementing this function is to define two variables a and b, where a is 0 and b is 1. Then implement the following rules concerning a and b.
(1) if b >= n, stop and let fib = a.
(2) else, let a = b and b = a + b (be careful how you do this; otherwise, you'll get b = b + b). Repeat.
In matlab

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!