Write a python program to calculate simple interest and compound interest.
PROGRAM:
# Formula for simple interest= p*n*(r/100)
# p=principal amount, n=Tenure(Duration), r=rate
# Formula for compound interest=(p(1+(r))^(nt))-p
# t=Number of time periods elapsed.
p=float(input("Enter a prinicipal amount:"))
n=float(input("Enter the duration (tenure)in year:"))
r=float(input("Enter the rate value in %:"))
s=p*n*(r/100)
c=(p*((1+r/100)**(t)))-p
print("Simple interest: Rs.",s)
print("Compound interest: Rs.",c)
OUTPUT:
No comments:
Post a Comment