Question: Question 4 (10 marks) a) Give one difference between while and for loop syntax. (2 marks) b) Compound interest can be calculated using the following
Question 4 (10 marks) a) Give one difference between while and for loop syntax. (2 marks) b) Compound interest can be calculated using the following formula: B = a(1+r)" where, a is the invested money; r is the interest rate; n is the total of years, and B is the final balance. Let r = 8%. Using while loop, write a MATLAB code to calculate B for a = (100, 500,800) and n = {2,4,6,8,10). (8 marks) a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
