# Python Program to Compute Simple Interest

Have you mastered basic programming topics of java and looking forward to mastering advanced topics in a java programming language? Go with these ultimate Advanced java programs examples with output & achieve your goal in improving java coding skills.

Simple Interest:

Simple interest (S.I) is the way by which the interest amount is calculated for a capital amount. If your pocket money is exhausted, did you ever borrow your siblings? Or perhaps lent him? When you borrow money, what happens? You utilize this money first and foremost for the purpose you borrowed. Afterwards, when you get your parents’ pocket money the next month, you give the money back. That’s how to borrow and lend at home.

But in the real world, money is not free to borrow. You typically have to borrow money from banks in the form of a loan. You paid a certain amount of money during paybacks, apart from the amount of the loan, depending both on the lending amount and on the lending time. Simple interest is called this. This word is often used in the banking industry.

Given all the required values like amount ,rate and time the task is to calculate the simple interest for the given values in Python

Examples:

Example1:

Input:

given amount=18816

given time= 3

given rate= 8.43

Output:

Example2:

Input:

given amount=49332

given time=3.4

given rate=6.732

Output:

The simple interest for the amount 49332 in 3.4 at the rate 6.732 % = 11291.502815999998

## Program to Compute Simple Interest in Python

We can calculate simple interest easily using python:

Drive into Python Programming Examples and explore more instances related to python concepts so that you can become proficient in generating programs in Python Programming Language.

Formula for simple interest is given by:

SimpleInterest = (P x T x R) / 100

where

P= Principal Amount(given amount in this case)

T = Time Period (given time in this case)

R = Rate of interest( given rate in this case)

The primary complexity is the user’s input, since the values can be either decimal (float) or integer.

### Method #1: Calculating Simple interest  (Static Input)

Approach:

• Enter the values as static for  amount, rate and time
• Calculate the simple interest using the formula.
• Print the calculated simple interest value.
• exit of program

Below is the implementation:

# given amount
given_amount = 18816
# given time in years
given_time = 3
# given rate of interest
given_rate = 8.43
# calculating simpleInterest using formula
simpleInt = (given_amount*given_time*given_rate)/100
# printing the simpleInterest of the above values
print("The simple interest for the amount", given_amount, "in",
given_time, "at the rate", given_rate, "% =", simpleInt)


Output:

The simple interest for the amount 18816 in 3 at the rate 8.43 % = 4758.5664

Explanation:

• User will enter the static values
• For calculating a simple interest, the formula (amount*time*rate):/100 is used.
• The simple  interest is printed subsequently.

### Method #2: Calculating Simple interest (User Input)

Approach:

The application will request that the user first enter all three values. The input values of the user are floating. We can also utilize entities, although integer types are unlikely to always hold the main amount, time and interest. Then the simple interest will be calculated using the above formula and the result is printed.

Below is the implementation:

# given amount
given_amount = float(input("Enter the amount of which you want to calculate simple interest ="))
# given time in years
given_time=float(input("Enter the time of which you want to calculate simple interest = "))
# given rate of interest
given_rate=float(input("Enter the rate of interest of which you want to calculate simple interest = "))
# calculating simpleInterest using formula
simpleInt=(given_amount*given_time*given_rate)/100
# printing the simpleInterest of the above values
print("The simple interest for the amount", given_amount, "in",
given_time, "at the rate", given_rate, "% =", simpleInt)


Output:

Enter the amount of which you want to calculate simple interest =39929
Enter the time of which you want to calculate simple interest = 7.5
Enter the rate of interest of which you want to calculate simple interest = 3.24
The simple interest for the amount 399299.0 in 7.5 at the rate 3.24 % = 97029.657

Explanation:

Take the user input for the amount, time and rate of interest for calculation of the simple interest in years. We read

the data with the input() method and then use float() to convert it to a floating point number. The method input()

reads the input of the user as a string. Therefore, initially we must convert it to float.

For calculating a simple interest, the formula (amount*time*rate):/100 is used.

Related Programs: