#### Converting Decimals to Binary Numbers

In order to convert decimals to binaries, we reverse the process outlined in Section G.1 for converting a binary to a decimal.

41_{10} = | 20x2 | + 1 | Dividing 41 by 2, gives the quotient 20 and remainder 1. |

20_{10} = | 10x2 | + 0 | We again divide the current quotient 20 by 2. |

10_{10} = | 5x2 | + 0 | |

5_{10} = | 2x2 | + 1 | We repeat this procedure until ... |

2_{10} = | 1x2 | + 0 | |

1_{10} = | 0x2 | + 1 | ... the quotient is 0. |

41_{10} = | 101001_{2} |

The divisor used in the steps above is the base of the target number system (binary, base 2). The binary value, 101001_{2}, is represented by the remainders, with the last remainder as the left-most bit. Back substitution of the quotient gives the same result:

41_{10} | = (((((0x2 + 1)x2 + 0)x2 + 1)x2 + 0)x2 + 0)x2 + 1 |

| = 1x2^{5} + 0x2^{4} + 1x2^{3} + 0x2^{2} + 0x2^{1}+ 1x2^{0} |

| = 101001_{2} |

#### Converting Decimals to Octal and Hexadecimal Numbers

Analogously, we can apply the above procedure for converting an octal to a binary. The conversion for the decimal number 90 can be done as follows:

90_{10} = | 11x8 | + 2 |

11_{10} = | 1x8 | + 3 |

1_{10} = | 0x8 | + 1 |

90_{10} = | 132_{8} = `0132` |

The remainder values represent the digits in the equivalent octal number: `132`_{8}. This can be verified by back substitution, which gives the following result:

90_{10} | = ((0x8 + 1)x8 + 3)x8 + 2 |

| = 1x8^{2} + 3x8^{1} + 2x8^{0} |

| = 132_{8} = `0132` |

Conversion to hexadecimal is analogous:

90_{10} = | 5x16 | + 10 |

5_{10} = | 0x16 | + 5 |

90_{10} = | 5a_{16} = `0x5a` |

The remainders represent the digits of the number in the hexadecimal system: `5a`. Back substitution gives the same result:

90_{10} | = (0x16+ 5)x16 +10 |

| = 5x16^{1} + ax16^{0} |

| = 5a_{16} = `0x5a` |