Compound interest is the method of calculating interest on an amount of money by adding interest that is earned each…