Twos Complement Exercise

download Twos Complement Exercise

of 2

Transcript of Twos Complement Exercise

  • 7/23/2019 Twos Complement Exercise

    1/2

    Two's Complement Exercises

    Answers:

    1.Find the 8-bit two's complement of 26 10

    a) write the 8-bit binary representation of 2610

    2610= 16 ! 8 ! 2)10= 110102= 000110102

    b) switch all the 1's to 0's and 0's to 1's

    111001012

    c) add 1 in binary notation

    1 1 1 0 0 1 0 12! 1

    1 1 1 0 0 1 1 02

    "herefore# the 8-bit two's complement of 26 10is 111001102$

    2$ Find the decimal representation of the two's complement n%mber 110100112

    a) find the two's complement of 11010011

    1$ switch all 1's to 0's and 0's to 1's & 11010011 001011002

    2$ add 1 in binary notation

    0 0 1 0 1 1 0 02! 1

    0 0 1 0 1 1 0 12

    b$ write the decimal representation of 001011012

    001011012= 2 ! 8 ! ( ! 1) 10= (10

    "herefore# the decimal representation of the two's complement 110100112is -(10$

  • 7/23/2019 Twos Complement Exercise

    2/2