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 | + | We again divide the current quotient 20 by 2. | 10 10 = | 5x2 | + | | 5 10 = | 2x2 | + 1 | We repeat this procedure until ... | 2 10 = | 1x2 | + | | 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 | | = 1 x2 5 + x2 4 + 1 x2 3 + x2 2 + x2 1 + 1 x2 | | = 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 | | = 1 x8 2 + 3 x8 1 + 2 x8 | | = 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 | | = 5 x16 1 + a x16 | | = 5a 16 = 0x5a | |