Prove 2 + 2 = 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Prove 2 + 2 = 5

challenges

20th Oct 2017, 2:10 AM
Shantanu Kundu
Shantanu Kundu - avatar
1 Answer
+ 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
20th Oct 2017, 4:27 AM
vincent
vincent - avatar