Generate Loan EMI Schedule With Paise-Accurate Final Installment
Last updated: November 29, 2026
Quick Overview
Given a loan principal, an annual interest rate and a tenure in months, compute the monthly EMI and an amortization schedule where each row splits the payment into interest and principal, rounding to two decimals and adjusting the last installment so the balance ends at exactly zero.
TCS
November 29, 20260
0
0 solved
Given a loan principal, an annual interest rate and a tenure in months, compute the monthly EMI and an amortization schedule where each row splits the payment into interest and principal, rounding to two decimals and adjusting the last installment so the balance ends at exactly zero.
Lending modules in TCS BaNCS and the bank projects TCS delivers depend on amortization math that matches to the paise. A technical interviewer uses this to check formula knowledge, money handling with Decimal instead of float, and the rounding drift that shows up in the final row.
What the Interviewer Expects
- State the EMI formula and the zero-interest special case
- Use Decimal (or integer paise) instead of float for money
- Round interest each month and carry the real balance forward
- Absorb rounding drift in the last installment
- Explain why the schedule must reconcile to the principal
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would a part-prepayment in month 6 change the schedule (reduce EMI vs reduce tenure)?
- How do you handle a rate change mid-tenure on a floating-rate loan?
- Why does float arithmetic fail an audit here?
- How would you test this against a bank's published schedule?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Monthly rate . EMI , or when . Each month: interest round(balance ), principal part EMI interest, balance reduces b...
High-Level Design
Compute the rounded EMI once, then iterate months. Because both EMI and monthly interest are rounded, the last month's balance drifts by a few paise, so the final installment is defined as remaining b...