Exercise

Calculating compound interest

Compound interest is much more applicable in the real world and is an important feature in calculating the price of a bond, as you will see in the next chapter.

Now imagine the same savings account pays 3% per year as compound interest instead of simple interest. As before, you invest USD 10,000 for a period of ten years.

Instructions

100 XP
  • Assign the present value, rate, and number of periods to pv, r, and n, respectively.
  • Find how much money the savings account will have after ten years and print the result.
  • Calculate and print the amount of interest earned over the ten years.