How to add two numbers using only bitwise operators, booleans and assignment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to add two numbers using only bitwise operators, booleans and assignment?

You can only use |, &, ^, <<, >>, ~, |=, &=, ^=, <<=, >>=, &&, ||, !, and = You can create any variable you want.

27th Jun 2016, 7:36 PM
Garme Kain
Garme Kain - avatar
3 Answers
0
why do you need that? It is pretty much impossible
28th Jun 2016, 9:23 AM
Armandas Bolevičius
Armandas Bolevičius - avatar
0
ummmm.....you know u can just put variable++ or ++variable to add
28th Jun 2016, 12:52 PM
Eric Nguyen
Eric Nguyen - avatar
0
well in boolean we can only have two values i.e. 0 or 1.so, you can add then using AND I guess it will help😊
2nd Jul 2016, 11:08 AM
Mukul