Computer Science, asked by dheerajk1912, 11 months ago

Write a python programming for calculating compound interest

Answers

Answered by harshrajsingh567
0

Answer:

Python Program to Calculate Compound Interest

def compound_interest(principle, rate, time):

result = principle * (pow((1 + rate / 100), time.

return result.

p = float(input("Enter the principal amount: "))

r = float(input("Enter the interest rate: "))

t = float(input("Enter the time in years: "))

amount = compound_interest(p, r, t)

interest = amount - p.

Answered by Equestriadash
9

The following codes must be typed in script mode, saved and then executed.

CODE 1:

p = float(input("Enter the principal amount:"))

r = float(input("Enter the interest rate:"))

n = float(input("Enter the tenure of compoundings:"))

t = float(input("Enter the time period:"))

print("The compound interest is", p*(1 + r/n)**n*t)

OUTPUT:

\tt Enter\ the\ principal\ amount: 4000

\tt Enter\ the\ interest\ rate: 5

\tt Enter\ the\ tenure\ of\ compoundings: 1

\tt Enter\ the\ time\ period: 2

\tt The\ compound\ interest\ is\ 576000000

CODE 2:

p = float(input("Enter the principal amount:"))

r = float(input("Enter the interest rate:"))

n = float(input("Enter the tenure of compoundings:"))

t = float(input("Enter the time period:"))

a = p*(1 + r/n)**n*t

print("The compound interest is", a)

OUTPUT:

\tt Enter\ the\ principal\ amount: 4000

\tt Enter\ the\ interest\ rate: 5

\tt Enter\ the\ tenure\ of\ compoundings: 1

\tt Enter\ the\ time\ period: 2

\tt The\ compound\ interest\ is\ 576000000

Similar questions