Perform the bitwise operation OR
on the numbers !6 | !5
Since Number 1 of 6 is not in binary form, we need to convert it to binary format
From this conversion, we get 110 as our binary number
Since Number 2 of 5 is not in binary form, we need to convert it to binary format
From this conversion, we get 101 as our binary number
For 1, switch all 1's with 0's and all 0's with 1's
1 → 0
1 → 0
0 → 1
Our negation number is 001
For 2, switch all 1's with 0's and all 0's with 1's
1 → 0
0 → 1
1 → 0
Our negation number is 001010
Make sure each of binary term has a length of 3,
the length of our longest binary number
For a bitwise OR operation, bit 1 or bit 2 or both bit 1 and bit 2 need to be 1
For bit 1, this is not the case: 0 OR 0 = 0
For a bitwise OR operation, bit 1 or bit 2 or both bit 1 and bit 2 need to be 1
For bit 2, this is the case: 0 OR 1 = 1
For a bitwise OR operation, bit 1 or bit 2 or both bit 1 and bit 2 need to be 1
For bit 3, this is the case: 1 OR 0 = 1
0 | 0 | 1 | ||
OR | 0 | 1 | 0 | |
= | 0 | 1 | 1 |
Using our binary calculator, we can convert 001010011 to an integer.