The Loan Calculator can be used to calculate monthly EMI of the loan by taking the total amount, months to repay and the rate of interest.
Approach: The approach is very simple, we will take 3 inputs from user i.e. amount (total loan amount), rate (the rate of interest) and months (number o months to repay). Using these three, we can calculate the total amount. At last we will display the total amount.
interest = (amount * (rate * 0.01))/months; total = ((amount/months) + interest);
Using HTML we are designing the simple structure and giving style using CSS(internal CSS). At the time of input we are calling calculate() function and displaying the result. The calculate() function takes input using HTML attribute named – onchange (the onchange attribute fires the moment when the value of the element is changed).
- HTML – (index.html)