Fix ‘max call stack’ error in interest calculator

Use a while loop instead of recursion