Can anyone explain why the output of OR and XOR are like that what not the output of OR is {0,10,1,3,7,9,11,13} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone explain why the output of OR and XOR are like that what not the output of OR is {0,10,1,3,7,9,11,13}

https://code.sololearn.com/c0nQ6AY0YR77/?ref=app

24th May 2020, 11:57 AM
๐ŸŽถ๐Ÿ’žSravs๐Ÿ’ž๐Ÿฅ€
๐ŸŽถ๐Ÿ’žSravs๐Ÿ’ž๐Ÿฅ€ - avatar
2 Answers
0
Consider that bits2 got changed with each of the operations. When you execute one of them only, you will get different results. So when you execute the "xor" only, you get the result you expect in your question. 1) and All odd bits are 0 now. 2) or Bits 0 and 10 get set to 1. 3) xor All bits are 0 now, because bits1 and bits2 were equal.
24th May 2020, 1:06 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
XOR usually will be used for finding of bits, which have changed to a previous situation.
24th May 2020, 1:55 PM
JaScript
JaScript - avatar