The program
Edit anything and press Run. The output below was produced by running this exact code.
Expected output
Press Run to try it
Principal: Rs 10000 | Rate: 8% | Time: 3 saalSimple interest: Rs 2400Total (simple): Rs 12400Total (compound): Rs 12597Compound ka fayda: Rs 197
How it works
Simple interest is principal x rate x time / 100 — simple_interest is that formula word for word. Adding it to the principal gives the total you get back.
Compound interest grows on the interest already earned, so the amount is principal x (1 + rate/100) to the power of time. ganit.pow does the power and ganit.round rounds to whole rupees.
The last line subtracts the simple total from the compound total to show the extra that compounding earns over three years.