Python Program to Calculate Simple & Compound Interest
This python program calculates simple and compound interest where principal amount, rate and time are given by user.
Following formula are used in this program to calculate simple and compound interest:
Simple Interest = (P*T*R)/100
Compound Interest = P * ( (1+r/100 )t - 1)
Python Source Code: Simple & Compound Interest
# Simple and Compound Interest
# Reading principal amount, rate and time
principal = float(input('Enter amount: '))
time = float(input('Enter time: '))
rate = float(input('Enter rate: '))
# Calcualtion
simple_interest = (principal*time*rate)/100
compound_interest = principal * ( (1+rate/100)**time - 1)
# Displaying result
print('Simple interest is: %f' % (simple_interest))
print('Compound interest is: %f' %(compound_interest))
Python Output: Simple & Compound Interest
Enter amount: 5000 Enter time: 2 Enter rate: 18 Simple interest is: 1800.000000 Compound interest is: 1962.000000