How to transfer numbers from one numbering system to another
numeration system - it is a way of writing numbers with certain characters. Most common are positional system defined integer called base. The most common reason to use 2.8, 10 and 16, and the systems are called, respectively, binary, octal, decimal and hexadecimal.
You will need:
translation table for binary, decimal, octal and hexadecimal systems
Instruction how to translate numbers from one numbering system to another
Consider the transfer of any radix (any integer in the base) in decimal. For this purpose, the required number, for example, 123 to be written on the record of the formula adopted in the original notation. Take for example the octal system. As the name suggests, the base is number 8, which means that each bit of a power base in descending order, in this case, the second, first and zero degree (8 in the zero degree = 1). The number 123 is written as follows: 1 * 8 * 8 + 2 * 8 + 3 * 1. Multiply the numbers and get 64 +16 +3, in the end - and the number 83. It is a representation of the desired number in the decimal system.
For hexadecimal calculation is more complicated. It is not a digit in the representation involving letters of the alphabet, that is, the full discharge of the digits 0 through 9 and the letters A to F. For example, the number of 6B6 according to the formula of the recording will be: 6 * 16 * 16 + 11 * 16 + 6 * 1, where B = 11. Multiply the numbers and get 1536 + 176 + 6, in the end - 1718. This - the same number in the decimal system.
Translation from decimal to binary, octal, and hexadecimal is done by successive division on the base (2, 8 and 16) as long as there will be a number less than the divisor. Remains are written in reverse order. For example, translate the number 40 into a binary system, for this: divide 40 by 2, write 0, 20, 2, e 0, 10, 2, e 0, 5 to 2, write 1, 2 on 2, write 0 and 1. We get the final number in the binary system - 101000.
Translate the number 123 from decimal to octal, residues also are written in reverse order. Divide 123 by 8, 15 turns and 3 in the residue, write 3. Divide 15 by 8, 1 and 7 is obtained in the residue, write 7. The most significant digit write the remainder 1. The total number - 173.
Translate the number 123 from decimal to hexadecimal. 123 divide by 16 to give 7, 11 in the residue. So figure MSB - 7, the figure is less than 11 base and designated by the letter B. We obtain the final number - 7B.
To put any number in the binary system, you need every source of discharge number written as four numbers under the table, for example, for the decimal system: 0 = 0000, 1 = 0001, 2 = 0010 3 = 0011, 4 = 0100, 5 = 0101, and so on.
To convert from binary to octal or hexadecimal need to break the original number to four or triads on the binary system, and then each of the combinations (triples or quads) is replaced by the corresponding figure in the final system.