V.Vidhya Logo

V.Vidhya

Loan Calculator


Build a text based Loan Calculator, which based on the given loan’s details by user, computes the down payment, monthly EMI, total payment over the loan tenure and the overpayment amount.

Instructions
  • Prompt user for:
    • total loan amount (in rupees)
    • loan tenure (in years)
    • annual interest rate (in percent)
    • down payment rate (percentage of total loan, 0 if no down payment)
  • Calculate:
    • down payment
    • monthly EMI:
      • For monthly EMI, first the annual interest rate needs to be converted to monthly interest rate.

        monthly_rate = (annual_interest_rate / 100) / 12

      • Then, the tenure in years needs to be converted to number of monthly installments.

      • Now finally, calculate EMI using the standard formula:

        EMI = (P x r x (1 + r)n) / ((1 + r)n - 1)

        where,

        P - financed principal amout after down payment

        r - monthly interest rate

        n - number of monthly installments

    • total payment over the loan tenure
    • overpayment amount (the extra amount compared to the original loan amount that is paid over the loan tenure)
  • Display the calculated values in a user friendly manner.
Expected Output
### Loan Calculator ###
Enter total loan amount (rs.): 250000
Enter loan tenure (in years): 5
Enter annual interest rate (in %): 12
Enter down payment rate (% of total amount, 0 if none): 10

### Loan Repayment Details ###
Down payment: rs.25000.00
Monthly EMI: rs.5005.00
Total amount paid: rs.325300.00
Total overpayment (interest): rs.75300.00


Feel free to implement additional features to enhance the user experience.


Prev Post
Nim Game
Next Post
Rock-Paper-Scissors Game