Decode School

Decode School - The School for Problem Solvers

Welcome to my blog. Subscribe and get my latest blog post in your inbox.

Simple interest in Python

Python program to get Principle amount, number of months, rate of interest from user and calculate

simple interest.

Sample Input 1:

5000 12 1.0

Sample Output 1:

600.00

Program or Solution

					    
							
p=float(input("Enter the Principal amount:"))
n=int(input("Enter the Number of Months:"))
r=float(input("Enter the rate of interest:"))
si=(p*n*r)/100
print("Simple Interest: {}".format(si))


					    
					

Program Explanation

Get principal p, number of months n and rate of intereset r as inputs.

(using input() statement) calculate Simple Intereset SI by formula SI= p*n*r/100 print Simple Interest SI using print() method.