Python Simple Interest Calculator
Simple Interest is calculated using the formula:
Simple Interest = (Principal × Rate × Time) / 100
Where,
- Principal is the initial amount of money
- Rate is the annual interest rate (in %)
- Time is the time period in years
Below, first see a fixed value example, then a dynamic example where you enter values via keyboard.
सरल ब्याज (Simple Interest) की गणना के लिए सूत्र है:
Simple Interest = (Principal × Rate × Time) / 100
जहाँ,
- Principal मतलब मूलधन (पहली रकम)
- Rate मतलब वार्षिक ब्याज दर (प्रतिशत में)
- Time मतलब समय अवधि (सालों में)
नीचे पहले fixed value से उदाहरण देखें, फिर user input से dynamic उदाहरण देखें।
Example 1: Fixed Values
# Fixed values
principal = 10000
rate = 5
time = 3
simple_interest = (principal * rate * time) / 100
print("Simple Interest is:", simple_interest)
Output:
आउटपुट:
Example 2: User Input Values
# Taking input from user
principal = float(input("Enter the principal amount: "))
rate = float(input("Enter the rate of interest (in %): "))
time = float(input("Enter the time period (in years): "))
simple_interest = (principal * rate * time) / 100
print("Simple Interest is:", simple_interest)
Sample Output:
नमूना आउटपुट:
In the second example, the program asks for input values from the user and calculates the simple interest dynamically.
दूसरे उदाहरण में, प्रोग्राम user से इनपुट लेता है और सरल ब्याज की गणना करता है।