In this post, we will learn how to write a simple interest program in Python by taking input from the user and also we will write this program using the function with a detailed explanation and algorithm.

But before we jump into the algorithm or programming part let’s first discuss the formula of simple interest.

Formula of Simple Interest

Formula of simple Interest


  • P = principal amount
  • R = Rate of interest
  • T = Time period

Algorithm for Simple Interest

  1. Take input from the user (p,r,t)
  2. To store the result create a variable called simple_interest and do step-3
  3. simple_interest = (p * r * t)/100
  4. At last print the result (print(simple_interest))

From the above algorithm, we understood how to write a Python program to calculate simple interest. So now let us do it practically.

Few programming concepts you have to know before writing this program:

Source Code

p = int(input("Enter Principal Amount: "))
r = int(input("Enter Rate of Interest: "))
t = int(input("Enter Time Period: "))

simple_interest = (p*r*t)/100

print(f"Simple Interest is: {simple_interest}")


Enter Principal Amount: 50000
Enter Rate of Interest: 10
Enter Time Period: 3
Simple Interest is: 15000.0

Now let us modify the above program and write it using the function.

Simple Interest Program in Python Using Function

Before writing this program Few programming concepts you have to know:

Source Code

def Cal_SI(p,r,t):
    return (p*r*t)/100

principal = int(input("Enter Principal Amount: "))
rate = int(input("Enter Rate of Interest: "))
time = int(input("Enter Time Period: "))

print(f"Simple Interest is: {Cal_SI(principal,rate,time)}")


Enter Principal Amount: 250000
Enter Rate of Interest: 7
Enter Time Period: 7
Simple Interest is: 122500.0

Hi, I'm Yagyavendra Tiwari, a computer engineer with a strong passion for programming. I'm excited to share my programming knowledge with everyone here and help educate others in this field.

Write A Comment