# python program to calculate compound interest

python program to calculate compound Interest using function, the input will be principal, the rate of interest and duration of time.

## what is Compound interest

### Compound interest formula

### A= P * (1 + R / 100) ^{t}

### CI=A-P

where

P principal

R Interest

t Time

A total amount

CI Compound interest

### The logic to find Compound Interest

- ask user to input and store in a variable
- principal in a variable P
- interest in a variable R
- Time in a variable T
- use the formula to find Compound interest
- print Compound interest

## python program to calculate compound interest

principle=float(input("Enter principle amount:")) time=int(input("Enter time duration:")) rate=float(input("Enter rate of interest:")) amount = (principle * (1 + (float(rate)/100))**time) compound_interest=amount-principle; print("Total amount:- ",amount) print("Compound interest:- ",compound_interest)

## python program to calculate compound interest using function

principle=float(input("Enter principle amount:")) time=int(input("Enter time duration:")) rate=float(input("Enter rate of interest:")) def cou_interest(principle,time,rate): return (principle * (1 + (float(rate) / 100)) ** time) amount =cou_interest(principle,time,rate) compound_interest=amount-principle; print("Total amount:- ",amount) print("Compound interest:- ",compound_interest)

use online IDE to Run and get output Click here

you may also like