A decimal number can be easily converted to any other integer using the method of repeated division.
Repeated Division
- Divide the decimal number by the desired base. Write down the integer quotient and keep the remainder.
- Convert the remainder to its equivalent in the new base (0-9 for bases 2-10, then A-F, etc. for higher bases).
- Repeat steps 1 and 2 with the quotient, treating it as a new decimal number. Stop when the quotient becomes 0.
- Read the remainders in reverse order. This will be your number in the new base.
Example1: Convert 255 to base 8 (octal).
- 255 ÷ 8 = 31, remainder 7
- 31 ÷ 8 = 3, remainder 7
- 3 ÷ 8 = 0, remainder 3
Therefore, 255 in octal is 377.
Example2: Convert 255 to hexadecimal.
- 255 ÷ 16 = 15, remainder 15 (F)
- 15 ÷ 16 = 0, remainder 15 (F)
Therefore, 255 in hexadecimal is FF.