Assume you start with $100 in a saving account that earns 12% per year. The monthly interest rate is 12%/12 = .12/12 = .01. After the first month there is 100 + (.01)*100 in the account = 101

After the second month there is:

101 + (.01)* (101) = 102.01

Thus each month is adding .01 times previous month to previous month value as new saving value.

Write a program that reads in initial saving value (make it $100) and reads in interest rate (make it .12) per year and then figures out how much will be in the account after 4 months.

1 answer

read amount
read rate
mrate = rate/12.0

bal = amount * (1+mrate)^4
that last expression might vary, depending on the language:
(1+mrate)**4
pow(1+mrate,4)