Given two integers a
and b
, compute their sum without using addition or subtraction operators.
a: number
: An integerb: number
: An integerInput: a = 1, b = 2Output: 3Explanation: a:=1 plus b:=2 equals 3 which is the expected output.
Input: a = -1, b = -2Output: -3Explanation: a:=-1 plus b:=-2 equals -3 which is the expected output.
Input: a = 0, b = 0Output: 0Explanation: a:=0 plus b:=0 equals 0 which is the expected output.
a
, b
<= 1000Given two integers a
and b
, compute their sum without using addition or subtraction operators.
a: number
: An integerb: number
: An integerInput: a = 1, b = 2Output: 3Explanation: a:=1 plus b:=2 equals 3 which is the expected output.
Input: a = -1, b = -2Output: -3Explanation: a:=-1 plus b:=-2 equals -3 which is the expected output.
Input: a = 0, b = 0Output: 0Explanation: a:=0 plus b:=0 equals 0 which is the expected output.
a
, b
<= 1000console.log()
语句将显示在此处。