tmt1
- 230
- 0
"Assume integer variable A holds 60 and variable B holds 13 then:A&B will give 12"
Why is this?
Why is this?
The discussion centers on the bitwise AND operation between two integer variables, A and B, where A is 60 and B is 13. The result of the operation A & B equals 12, which is derived from their binary representations: A (0011 1100) and B (0000 1101). The truth table for the AND operation confirms that the resulting binary value is 0000 1100, which translates to the decimal value of 12. The discussion also briefly touches on related bitwise operations such as OR (|) and XOR (^).
PREREQUISITESThis discussion is beneficial for programmers, computer science students, and anyone interested in understanding bitwise arithmetic and its applications in coding and algorithm optimization.
tmt said:"Assume integer variable A holds 60 and variable B holds 13 then:A&B will give 12"
Why is this?
evinda said:Write the binary represetation of $A$ and $B$ and then add them.
For example, the binary representation of $A$ is $0011 1100$.
tmt said:I get 01001001 how is this 12?