Need some help with C programming Please show all work if po
Need some help with C programming. Please show all work if possible. Thanks.
Perform the following operations 3242 + 011010_2 ~46 192 & 255 192 | 255 192^255 48 & 92 | 118 4 4 (512 + 213) (231 % 3)Solution
. ~46
~ ---> Binary Ones Complement Operator is unary and has the effect of \'flipping\' bits.
A=46, 00101110 in binary and its 2\'s complement value is -47
so ~46 = -47 i.e 00101110 in 2\'s complement form.
3.192&255
& --> Binary AND Operator copies a bit to the result if it exists in both operands.
192 11000000
255 11111111
---------------------
192 11000000
so 192&255 = 192
4.192|255
| --> Binary OR Operator copies a bit if it exists in either operand.
so 192|255 = 255
5.192^255
^ -->Binary XOR Operator copies the bit if it is set in one operand but not both.
So
192 11000000
255 11111111
-----------------
63 <--00111111
So 192^255 = 63
6.48&92|118
Associativity -- > is Left to Right
so first compute (48&92),then compute the result with |118
48 00110000 AND
92 01011100
---------------
0001 0000 OR
118 01110110
----------------
118
so value =118
7.4<<4
<< -->Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.
0000 0100 shift left to 4 places
0100 0000 = 64
8.256>>4
>> Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.
0000 0001 0000 0000
0000 0000 0001 0000 =16
9.(512+213)<(0111011*3)
<-- checks if thwe left side value is less than right side value,if true then it returns 1 else 0.
10.(213/3)>(213/3)
Here remember the BODMS rule (Bracket of Division Multiplication Summ/substraction) i.e first consider the bracket and then div then mul then sub/add
> -- checks if left value is greateer than right,if true returns 1 ,elso 0.
Here both the values are equla hence the output is 0.


