Maximum value of B less than A such that A ^ B = A + B | Function to find the maximum value of B such that A ^ B = A + B ; Binary Representation of A ; Loop to find the negation of the integer A ; Output ; Driver code ; Function Call
function maxValue ( a ) { var c = a . toString ( 2 ) ; var b = " " ; for ( var i = 0 ; i < c . length ; i ++ ) { if ( ( c [ i ] - ' ' ) == 1 ) b += ' ' ; else b += ' ' ; } document . write ( parseInt ( b , 2 ) ) ; } var a = 4 ; maxValue ( a ) ;