Simple interest formula is given by: Simple Interest = (P x T x R)/100 Where, P is the principal amount T is the time and R is the rate
Examples:
Input : P = 10000
R = 5
T = 5
Output :2500.0
We need to find simple interest on
Rs. 10,000 at the rate of 5% for 5
units of time.
Python Program for simple interest
Python3
# Python3 program to find simple interest# for given principal amount, time and# rate of interest.def simple_interest(p,t,r): print('The principal is', p) print('The time period is', t) print('The rate of interest is',r) si = (p * t * r)/100 print('The Simple Interest is', si) return si # Driver codesimple_interest(8, 6, 8) |
Output
The principal is 8 The time period is 6 The rate of interest is 8 The Simple Interest is 3.84
Time complexity: O(1)
Auxiliary Space: O(1)
Program for simple interest with Taking input from user
We can calculate the simple interest by taking P,T and R from the user.
Python3
# Python3 program to find simple interest# principal amount, time and# rate of interest taken from user.def simple_interest(p,t,r): print('The principal is', p) print('The time period is', t) print('The rate of interest is',r) si = (p * t * r)/100 print('The Simple Interest is', si) # Driver codeP = int(input("Enter the principal amount :"))T = int(input("Enter the time period :"))R = int(input("Enter the rate of interest :"))simple_interest(P,T,R) |
Output:
Input:
Enter the principal amount :3000
Enter the time period :7
Enter the rate of interest :1
Output:
The simple interest is 210.0
Time complexity: O(1)
Auxiliary Space: O(1)
#Please refer complete article on Program to find simple interest for more details!
Share your thoughts in the comments

