See also: Integer Representation
Use the following algorithm to construct base b expansions of an integer n.
- First divide n by b to get a quotient and remainder The remainder is the first digit in the base b expansion of n
- Next divide by b to obtains The remainder is the 2nd digit in the base b expansion of n
- Repeat the steps above until you get 0 as a quotient.
Example
Find the find binary expansion of
Conversion between binary, octal, hexadecimal
Example
Find the octal and hex expansions of 011|111|0 10|11 1|100 3 | 7 | 2 | 7 | 4
0011|1110|1011|1100 3 | 14 | 11 | 12
Example
Find the binary expansions of and (7 6 5
(A 8 D