# 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).

# 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

# 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

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. 