Sagot :
Answer: 0
int Result = a & b;
& means binary AND
Let as use this table:
1 & 1 = 1
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
Now convert a and b to binary.
2 & 5 = ?
0010 & 0101 = _ _ _ _
Solve:
0 & 0 = 0
0010 & 0101 = 0 _ _ _
0 & 1 = 0
0010 & 0101 = 0 0_ _
1 & 0= 0
0010 & 0101 = 0 0 0 _
0 & 1 =1
0010 & 0101 = 0 0 0 0
Now convert to decimal:
0 * 2^4 + 0 * 2^2 + 0 * 2^1 + 0 * 2^0 = 0
Answer:
int Result = a & b;
Result == 0