Python Simple Interest Calculator | Live Code Programming

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:

Simple Interest is: 1500.0

आउटपुट:

सरल ब्याज है: 1500.0
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:

Enter the principal amount: 20000 Enter the rate of interest (in %): 6 Enter the time period (in years): 4 Simple Interest is: 4800.0

नमूना आउटपुट:

प्रिंसिपल डालें: 20000 ब्याज दर डालें (प्रतिशत में): 6 समय अवधि डालें (सालों में): 4 सरल ब्याज है: 4800.0

In the second example, the program asks for input values from the user and calculates the simple interest dynamically.

दूसरे उदाहरण में, प्रोग्राम user से इनपुट लेता है और सरल ब्याज की गणना करता है।