+ 2
Prove 2 + 2 = 5
challenges
2 Antworten
+ 4
In computer programming, this could be achieved by using logical shift.
2 >> 1 means 2 is shifted to the right by 1 bit
+ 2 << 1 means is shifted to the left by 1 bit
---------
5
explanation:
a. right shift
convert 2 to binary format which is 0010 and right shift value
by 1 bit so it becomes 0001.
b. left shift
convert 2 to binary format which is 0010 and left shift value
by 1 bit so it becomes 0100.
c. add the right and left shifted values :
0001
+ 0100
------
0101
converting 0101 to decimal format which is 5