File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
2
- function calculateLoan ( ) {
3
- const amount = document . querySelector ( "#amount" ) . value ;
4
- const interestRate = document . querySelector ( "#interest" ) . value ;
5
- const months = document . querySelector ( "#months" ) . value ;
2
+ function calculateLoan ( ) {
3
+ const amount = document . querySelector ( "#amount" ) . value ;
4
+ const interestRate = document . querySelector ( "#interest" ) . value ;
5
+ const months = document . querySelector ( "#months" ) . value ;
6
6
7
- const monthlyRate = ( interestRate ) / ( 12 * 100 ) ;
8
- const onePlusR = Math . pow ( 1 + monthlyRate , months ) ;
9
- const den = onePlusR - 1 ;
7
+ const monthlyRate = ( interestRate ) / ( 12 * 100 ) ;
8
+ const onePlusR = Math . pow ( 1 + monthlyRate , months ) ;
9
+ const den = onePlusR - 1 ;
10
10
11
- const emi = ( amount * monthlyRate * ( onePlusR / den ) ) . toFixed ( 2 ) ;
12
- const totalPay = ( emi * months ) . toFixed ( 2 ) ;
11
+ const emi = ( amount * monthlyRate * ( onePlusR / den ) ) . toFixed ( 2 ) ;
12
+ const totalPay = ( emi * months ) . toFixed ( 2 ) ;
13
13
14
- document . querySelector ( "#payment" ) . innerHTML = `EMI: ₹ ${ emi } <br><br> Total Payment: ₹${ totalPay } `
14
+ document . querySelector ( "#payment" ) . innerHTML = `EMI: ₹ ${ emi } <br><br> Total Payment: ₹${ totalPay } `
15
15
16
- }
16
+ }
You can’t perform that action at this time.
0 commit comments