Amortising EMI maths
Monthly rate r = annual percent ÷ 12 ÷ 100. With principal P and N months, EMI = (P × r × (1+r)^N) ÷ ((1+r)^N − 1). Total payment is EMI × N; interest is total minus principal. EMI, total, and interest round to two decimals in the output.
When the annual rate is 0%, EMI becomes principal ÷ months, total equals principal, and interest is 0. Missing principal or months returns Invalid.
What is left out
Processing fees, taxes, balloon payments, and variable rates are not modeled. Treat the figures as a quick sanity check before talking to a lender. Confirm whether a quoted rate is reducing or flat, and recalculate when tenure switches between months and years so you are not comparing mismatched offers.
Questions
Is the rate nominal annual?
Yes — B is the yearly percentage divided into equal monthly rates, not daily compounding.