Reduce N to 0 or less by given X and Y operations | Function to check if N can be reduced to <= 0 or not ; Update N to N / 2 + 10 at most X times ; Update N to N - 10 Y times ; Driver code
function NegEqu ( N , X , Y ) { while ( X > 0 && ( N > N / 2 + 10 ) ) { N = N / 2 + 10 ; X -= 1 ; } while ( Y > 0 ) { N = N - 10 ; Y -= 1 ; } if ( N <= 0 ) return true ; return false ; } let N = 100 ; let X = 3 ; let Y = 4 ; if ( NegEqu ( N , X , Y ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }