RUN

# Program to find Compound Interest in Python

Written By -

In this example, we will learn how to find a compound interest using python.

In this program, we should know the formula and basic concept to solve the question.

Thus the formula of compound interest is:  P(1+R/100)*

where,

p = principal amount

R= rate of interest

T= time span

Algorithm:

1. Input the principal amount and rate of interest from the user.
2. Input the time in years from the user.
3. Using for loop, find the Compound Interest by simply using the above formula.
4. Print the result.
5. Exit

Code:

``````n=int(input("Enter the principle amount:"))

rate=int(input("Enter the rate:"))

years=int(input("Enter the number of years:"))

for i in range(years):

n=n+((n*rate)/100)

print(n)``````

Output:

``````Enter the principle amount:100

Enter the rate:2

Enter the number of years:2

104.04``````

Report Error/ Suggestion

Related Posts:

Tutorials

Examples

Online Compilers

Interview Questions

Recent Articles

CopyRight © 2020

CopyRight © 2020