Add two numbers using ++ and / or | Returns value of x + y without using + ; If y is positive , y times add 1 to x ; If y is negative , y times subtract 1 from x ; Driver code
function add ( x , y ) { while ( y > 0 && y != 0 ) { x ++ ; y -- ; } while ( y < 0 && y != 0 ) { x -- ; y ++ ; } return x ; } document . write ( add ( 43 , 23 ) + " " ) ; document . write ( add ( 43 , - 23 ) + " " ) ;