• Embed Doc
  • Readcast
  • Collections
  • 1
    CommentGo Back
 
1
TA C162 Computer Programming I
13/01/2009
Today’s Agenda
Representation of Binary Numbers
Unsigned, Signed Magnitude, 1s ComplimentDone !!!2’s Complement
Base Conversion
Binary to Decimal and Decimal to BinaryDone !!!
Decimal to Octal and Octal to Decimal
Octal to Binary and Binary to Octal
Binary to Hexadecimal and Hexadecimal to Binary
 
2
TA C162 Computer Programming I
13/01/2009
Two’s Complement Representation
If number is positive or zero
Normal binary representation
If number is negative
Start with positive numberFlip every bit (i.e., take the one’s complement) Then add one
Example:
00101
(5)
01001
(9)
11010
(1’s comp)
 
10110
(1’s comp)
+ 1 + 1
11011
(-5)
10111
(-9)
 
3
TA C162 Computer Programming I
13/01/2009
Two’s Complement Shortcut
 To take the two’s complement of a number:
Copy bits from right to left until (and including) the first “1”Flip remaining bits to the left
011010000 011010000100101111
(1’s comp)
+ 1100110000 100110000
(copy)(flip)
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...

please sent this copy to me as its very usefull for me thanks friends_shreeta@hotmail.com

You must be to leave a comment.
Submit
Characters: ...