How Compound Interest works? and how to get profit from that in short or long term?

What is Compound Interest?

Compound interest is the interest on a loan or deposit or investment calculated based on both the initial principal and the accumulated interest from previous periods. Compound Interest (CI) can be thought of as “Interest of Interest”, and will make sum or total grown faster rate than Simple Interest (SI).

Power of Compound Interest

Example How Compound Interest Works

  1. Consider your initial investment is 10000 rupees or dollars or any currency.
  2. If we take a daily 10% profit, then for 10000 rupees it’s 1000 rupees, (Initial Investment)10000 *(10/100) = 1000 rupees is the profit for 10% on 10000 investment.
  3. Now our total investment including our 1st-day profit is 11000 rupees, (Initial Investment)10000 + (Profit Amount)1000 = Total Investment(11000).
  4. Now the second day total investment amount we have is 11000 if we again take daily profit 10% of 11000 is 1100 rupees, then our total investment is 11000+1100 = 12100 rupees.

Note: See the below screenshot for a better understanding

Profit Percentage

Steps to Execute the Code.

  1. To try this on your own below I attached screenshot for your reference and calculation, open and copy the code using below raw code link, after you copy the code paste the code in any location on your pc or laptop and save the file as <file_name>.sh

To Download full shell script code,
Click here:
raw code

2. Lastly, run the code as “./<file_name>.sh”, then it will prompt for details like total investment, total daily profit percentage, and the total number of days investing or trading.

Details of the Investment
Shell Script code to check the compound interest for the long term.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
CloudTech Point

CloudTech Point

DevOps & Cloud Engineering | Unix/Linux | Development and Information Technology Tips & Solutions | Investing Tips | Stock Market