Search This Blog
Computer science and Information technology related stuffs blog for all the students. All notes and programs are available in our blog. Students and self learners can improve their knowledge and clear doubts themselves by our informative blog post contents. Start learn today by our blog!!
Featured
- Get link
- X
- Other Apps
Calculate Simple Interest in Python
Python - Simple Interest Calculation
Python - Simple Interest Calculation |
Source Code
Aim :
To calculate the simple interest by using formula in python
Algorithm :
- Get the required input from the user by using input statement for p(principal amount), n(number of years) and r(rate of interest).
- Calculate the simple interest by using formula (pnr/100)
- Display the result with the help of print statement.
Program:
#calculate simple interest (SI) using formula in python
#p represents principal amount, n represents number of years, r represents rate of interest
#get input for all above mentioned
p = int(input("Enter the principal amount : "))
n = int(input("Enter the number of years : "))
r = float(input("Enter the rate of interest : "))
#calculate simple interest by using the formula (pnr/100)
SI = (p*n*r)/100
#Display the simple interest using print statement
print("Simple Interest is ",SI)
Output :
Enter the principal amount :
100
Enter the number of years :
2
Enter the rate of interest :
0.3
Simple Interest is 0.6
Terminal Code :
Python - Simple Interest Program |
Terminal Output :
Python - Simple Interest Output |
Result :
For Medium Users - https://tharunkumarbtech.medium.com/
Personal Writings for Readers!!!
Story behind single family described in Pandemic Family Book.
Read more on...
Paperback - https://amzn.to/34NS6Sk
Amazon Kindle - https://amzn.to/3aKtIng
Kobo Writing - https://bit.ly/3iQysNy
Popular Posts
Introduction to Numpy Library in Python
- Get link
- X
- Other Apps
Program for Student Grade Calculation in Python
- Get link
- X
- Other Apps
Comments
Post a Comment