Can any body tell me what this "^" does in a program.For example 60 ^ 40 gives me 20 when I run it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can any body tell me what this "^" does in a program.For example 60 ^ 40 gives me 20 when I run it

I need an answer

28th Jun 2022, 3:12 PM
NS MICHAEL
NS MICHAEL - avatar
2 Answers
+ 5
MK MICHAEL it is called xor and it works with the bits of the number 60 in binary 111100 40 in binary 101000 ------------- 010100 20 it will output 1 if the two bits are different
28th Jun 2022, 3:54 PM
Aly Alsayed
Aly Alsayed - avatar
+ 1
Look for bitwise exclusive OR here https://www.sololearn.com/learn/4070/?ref=app
28th Jun 2022, 3:18 PM
Ipang