The formula for compound interest is A = P(1 + r/n)^nt, where A is an accrued amount, P is the principal amount, r is the interest rate, n is the number of times interest is compounded per unit of time, and t is the number of the time period.
For example, suppose you have invested Rs. 1,00,000 for 20 years. You are earning 10% per annum on your investments. With the above formula, you can calculate how much you will have at the end of 20 years.
A= 1,00,000(1+10%/1)^20 = Rs. 6,72,749
It means the total interest you have earned is 5,72,749 over the period of 20 years.