about | help | code help+videos | done | prefs |
You have a bank account which begins with P dollars (P>0) and has a yearly interest rate of r, compounded monthly. Notice that we didn't say "r percent" here so you should assume 0<r<1. Write a function annualInterestAmount(P,r,y) which computes the amount of money you'll have after y years, then returns the integer part of this number. Note that because compounding is happening more frequently than once per year the APY is greater than the APR, so you don't just have P(1+r) at the end of the first year. annualInterestAmount(1000, 0.03, 1) → 1030 annualInterestAmount(1000, 0.03, 2) → 1061 annualInterestAmount(1000, 0.03, 7) → 1233 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy