fork download
  1. function savingsBalance = CalculateBalance(numberYears, savingsBalance)
  2. % numberYears: Number of years that interest is applied to savings
  3. % savingsBalance: Initial savings in dollars
  4.  
  5. interestRate = 0.025; % 2.5 percent annual interest rate
  6.  
  7. % Complete the for loop to iterate from 1 to numberYears (inclusive)
  8. for year = 1:numberYears
  9. savingsBalance = savingsBalance + (savingsBalance * interestRate);
  10. end
  11.  
  12. end
  13.  
Success #stdin #stdout 0.08s 46748KB
stdin
Standard input is empty
stdout
Standard output is empty