Computer Science, asked by Pardeshi7687, 9 months ago

Int x=~1;what is the value of x?

Answers

Answered by Anonymous
5

Answer:

i think the answer is -2

#hope it helps you

please mark brainliest

Answered by anjalin
1

The value of x will be -2

Explanation:

  • \neg represents bitwise negation.
  • It computes the bitwise complement.
  • Every 1 is replaced by 0 and every 0 is replaced by 1.
  • The operand must have an integral type.
  • The result has the same type as the operand.
  • x is equal to 1.

   So,   1=(001)_{2}

         \neg 1=(110)_{2}

  • Here MSB(Most Significant Bit) is 1 which denotes that the number is negative.

         \neg 1=-(10)_{2}

         \neg 1=-(2)_{10}

  • Hence x=-2

Thus the value of x will be -2.

Similar questions