Skip navigation

This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.

Here is my work for problem 2.4:

Without converting the numbers to decimal or binary, try to solve the following
arithmetic problems, giving the answers in hexadecimal. Hint: just modify
the mothods you use for performing decimal addition and subtraction to use
base 16.

A. 0x502c + 0x8 =
B. 0x502c - 0x30 =
C. 0x502c + 64 =
D. 0x50da - 0x502c =

A. 0x502c + 0x8 =

  0x502c
  +  0x8
  ------
  0x5034

B. 0x502c - 0x30 =

  0x502c
  - 0x30
  ------
  0x4ffc


C. 0x502c + 64 =

  64 = 4 * 16 + 0
  4 = 0 * 16 + 4
  64 = 0x40

  0x502c
  + 0x40
  ------
  0x506c


D. 0x50da - 0x502c =

  0x50da
 -0x502c
 -------
    0xae

A. 0x502c + 0x8 = 0x5034
B. 0x502c - 0x30 = 0x4ffc
C. 0x502c + 64 = 0x506c
D. 0x50da - 0x502c = 0xae


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: