Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+3 votes

The compound interest formula A = P(1 + r/n) ^ nt has an exponent but I don't know how to type that in.

asked in CSC202 by (1 point)
edited by

1 Answer

+1 vote

That is the formula but in the context of Routine 3, problem 7, you don't need to use it.

The t in your formula is the number of years which could be a decimal. In this problem, we don't know the t.

Instead, if r/n is the monthly interest rate (n = 12) where r is the annual rate, then each month the interest is computed as balance times monthly interest rate and then that is added to the balance.

Think about how you could loop updating the balance each time through the loop so that you could count up the number of months you update the balance until you meet or exceed the goal.

answered by (1 point)

So is it that every time you add the interest onto the balance, a month has passed? But how could you end up getting a decimal if you count the months as months + 1?


Never mind I figured it out.