@@ -19,19 +19,19 @@ <h3>Loan Calculator</h3>
1919 < p > Months to Pay:
2020 < input type ="number " value ="1 " id ="months " min ="0 " onchange ="calculateLoan() "> </ p >
2121 < h2 id ="payment "> </ h2 > </ div >
22- < script src =" script.js " >
23- function calculateLoan ( ) {
24- const amount = document . querySelector ( "#amount" ) . value ;
25- const interestRate = document . querySelector ( "#interest" ) . value ;
26- const months = document . querySelector ( "#months" ) . value ;
27- const monthlyRate = ( interestRate ) / ( 12 * 100 ) ;
28- const onePlusR = Math . pow ( 1 + monthlyRate , months ) ;
29- const den = onePlusR - 1 ;
30- const emi = ( amount * monthlyRate * ( onePlusR / den ) ) . toFixed ( 2 ) ;
31- const totalPay = ( emi * months ) . toFixed ( 2 ) ;
32- document . querySelector ( "#payment" ) . innerHTML = `EMI: ₹ ${ emi } <br><br> Total Payment: ₹${ totalPay } `
33- }
22+ < script >
23+ function calculateLoan ( ) {
24+ const amount = document . querySelector ( "#amount" ) . value ;
25+ const interestRate = document . querySelector ( "#interest" ) . value ;
26+ const months = document . querySelector ( "#months" ) . value ;
27+ const monthlyRate = ( interestRate ) / ( 12 * 100 ) ;
28+ const onePlusR = Math . pow ( 1 + monthlyRate , months ) ;
29+ const den = onePlusR - 1 ;
30+ const emi = ( amount * monthlyRate * ( onePlusR / den ) ) . toFixed ( 2 ) ;
31+ const totalPay = ( emi * months ) . toFixed ( 2 ) ;
32+ document . querySelector ( "#payment" ) . innerHTML = `EMI: ₹ ${ emi } <br><br> Total Payment: ₹${ totalPay } `
33+ }
3434 </ script >
3535</ body >
3636
37- </ html >
37+ </ html >
0 commit comments