Python Program to Calculate Simple Interest using function

write a python program to take input (principle, rate and time) from the user and calculate the simple interest . Python Program to Calculate Simple Interest | Python Program to Calculate Simple Interest using function.

Formula To calculate simple interest

Simple Interest = (p * n * r) / 100

where,

            p = Principal,

             n = Years

             r = Rate of Interest

example:-

              Principal Amount = ₹ 15000

              Period = 2 years

              Rate of Interest = 5%

              Simple Interest = ₹ 1500

Logic to calculate simple interest

Step

Input

  1. principle amount in variable P.
  2. time in variable t.
  3. rate in variable r.
  4. Find simple interest using formula.
  5. SI = (p*t*r) / 100
  6. print output.

Python Program to find Simple Interest.

principle=float(input("Enter principle:"))
time=int(input("Enter year:"))
rate=float(input("Enter rate:"))
SI=(principle*time*rate)/100
print("The simple interest:- ",SI)

sample output:-

example1-
Enter principle- 5000
Enter rate- 5
Enter year-2

simple interest is:-500

example2-
Enter principle- 10000
Enter rate- 5
Enter year-2

simple interest is:-1000

example 3-

Enter principle- 5500
Enter rate- 7
Enter year-3

simple interest is:-1155




 

Python Program to Calculate Simple Interest
output

Python Program to Calculate Simple Interest using function

def simple_interest(p,r,t):
    SI = (principle * time * rate) / 100
    return SI
principle=float(input("Enter principle:"))
time=int(input("Enter year:"))
rate=float(input("Enter rate:"))
SI=simple_interest(principle,time,rate)
print("The simple interest:- ",SI)

 

Python Program to Calculate Simple Interest using function
output:-

you may also like….

C program to calculate simple interest using function

cpp program to calculate simple interest using function c++

java program to calculate simple interest using function

C# Program To Calculate the Simple Interest

Leave a Reply

Your email address will not be published. Required fields are marked *