Python Program for Compound Interest

Formula to calculate the compound interest is given below:
Compound Interest = P(1 + R/100)t
Where,
P is principle amount
R is the rate and
T is the time span

For example:
If Principle Amount : 1500
        Time: 3 years
        Rate: 2.5
then Compound interest is 1615.3359374999995

Python Program for Compound Interest

# Python3 program to find compound interest
# for given principal, rate and time
  
def compound_interest(principle, rate, time): 
    CI = principle * (pow((1 + rate / 100), time)) 
    print("Compound interest is", CI) 
  
compound_interest(1500, 2.5, 3)

Output:

Compound interest is 1615.3359374999995

Comments