Zed-King Institute

    Python Program to Calculate Simple Interest

    easyInput and operatorsPython

    A formula program seen in almost every beginner exam. It reads three values and applies the simple interest formula.

    The question

    Read the principal, the rate of interest (% per year) and the time in years — three integers, one per line. Print the simple interest SI = P × R × T / 100.

    The code

    program.py

    p = int(input())
    r = int(input())
    t = int(input())
    si = p * r * t / 100
    print("Simple Interest =", si)

    Input

    37000
    4
    3

    Output

    Simple Interest = 4440.0

    How it works

    1. 1Read principal p, rate r (per cent per year) and time t in years.
    2. 2Simple interest is p × r × t / 100.
    3. 3Print the result; since / is used, it prints with a decimal point.

    Common mistakes

    • Forgetting to divide by 100 — the rate is a percentage.
    • Reading all three values on one line when the question gives them on separate lines.

    Now solve a similar question yourself

    A new Python question every time, checked instantly.

    Practice questions

    More in Input and operators