Find the remaining balance after the transaction | Function to find the balance ; Check if the transaction can be successful or not ; Transaction is successful ; Transaction is unsuccessful ; Driver Code
function findBalance ( x , bal ) { if ( x % 10 == 0 && ( x + 1.50 ) <= bal ) { document . write ( ( bal - x - 1.50 ) . toFixed ( 2 ) ) ; } else { document . write ( ( bal ) . toFixed ( 2 ) ) ; } } var x = 50 ; var bal = 100.50 ; findBalance ( x , bal ) ;