0
int x = 8 , int y = 6, sopln(x&y)
Why is the answer 0......anyone can tell the reason
2 ответов
+ 1
8 = 1000 in binary
6 = 0110 in binary
& = 0000 in binary = 0 in decimal
When you AND (&) 2 binary numbers the bits in each place are compared. If both bits are 1 then the resulting bit is 1, otherwise, 0.
Table
& | 0 | 1
-------------
0 | 0 | 0
‐---‐--------
1 | 0 | 1
0
& is AND operator, has not binary value
1000
0110
---------
0000