![]() |
VOOZH | about |
Let us discuss the formula for compound interest. The formula to calculate compound interest annually is given by:
A = P(1 + R/100) t
Compound Interest = A - P
Where,
This example calculates compound interest using the ** (exponent) operator.
Compound interest: 133.0992000000001
Instead of using the ** (exponent) operator, we can also use Python's pow() function.
Compound interest: 6288.946267774416
This method allows the user to enter values at runtime. It uses the same formula but takes user input for principal, rate, and time using the input() function.
Output
Principal amount: 3000
Rate of interest: 5
Time in years: 3
Compound interest: 472.875
Please refer complete article on Program to find compound interest for more details!
In this example, we use a for loop to calculate compound interest by repeated multiplications.
Compound interest: 133.0992000000001