Computer Science, asked by nikkubhairam9486, 10 months ago

Explain 1's complement and 2's complement with example

Answers

Answered by Anonymous
22

Explanation:

For example, 1's complement of binary number 110010 is 001101. To get 2's complement of binary number is 1's complement of given number plus 1 to the least significant bit (LSB). For example 2's complement of binary number 10010 is (01101) + 1 = 01110.

Answered by anjalin
11

1's complement is inverting all the binary digits of a number

2's complement is adding 1 to the 1's complement of a number

1's Complement

  • 1's complement is used when we want to alter and invert all the significant binary digits of any number.
  • It changes all 0 to 1 and all 1 to 0 in the given number and the final generated number is 1's complement.
  • Let's take Decimal 5 as an example which is equivalent to 101 in Binary.
  • If we generate its 1's complement then it will be 010 which is 2 in Decimal.

2's complement

  • 2's complement is used to store and signify signed and negative numbers.
  • If we add 1 to LSB of any number 1's complement then it will result in 2's complement.
  • If we take Decimal 5 as an example then we know that 1's complement of it is 010
  • So 2's complement will be 011 which is equivalent to 3 in Decimal and it is the 2's complement for the given number.
Similar questions