**1. Binary number, octal number, hexadecimal number to decimal number**

There is a formula: the binary number, octal number, hexadecimal number of each digit respectively according to their cardinal number (n-1) power, the sum of its sum is the corresponding decimal number. One digit, n = 1; ten digit, n = 2… For example:

110b = 2nd power of 1 * 2 + 1st power of 1 * 2 + 0th power of 0 * 2 = 0 + 4 + 2 + 0 = 6D

110q = 2 power of 1 * 8 + 1 power of 1 * 8 + 0 power of 0 * 8 = 64 + 8 + 0 = 72d

110h = 2 power of 1 * 16 + 1 power of 1 * 16 + 0 power of 0 * 16 = 256 + 16 + 0 = 272d**2. Decimal number to binary number, octal number, hexadecimal number**

The method is the same, that is, the integer part uses the algorithm of dividing the base to get the remainder, the decimal part uses the method of multiplying the base to get the whole, and then the integer and the decimal part are spliced into a number as the final result of conversion.

For example, see page 16 of level 4 guidance.**3. Convert binary data to other data types**

3-1 binary to octal: starting from the decimal point, the integer part is left, and the decimal part is right. Each three digit binary is a group of one digit octal numbers, and those less than three digits are supplemented with 0,

Is the representation of a corresponding octal number.

010110.001100B=26.14Q

Octal to binary, on the contrary.

3-2 binary to decimal: see 1

3-3 binary to hexadecimal: starting from the decimal point, the integer part is to the left and the decimal part is to the right. Each four digit binary is a group of hexadecimal numbers,

If less than four digits are complemented by 0, it is the representation of a corresponding hexadecimal number.

00100110.00010100B=26.14H

Decimal to decimal

To convert the decimal system to each system, you only need to divide the weight of each system to obtain its remainder. The first remainder is a single digit, the second remainder is a ten digit, and so on, until the dividend is less than the weight, and the last dividend is the highest digit.**I. decimal to binary**For example: 55 to binary

2｜55

27 – 1 bit

13-1 second place

6-1 third place

3-0 fourth place

1-1 fifth place

If the divisor 1 is the seventh digit, 110111 will be obtained

**Decimal to octal**

For example: 5621 to octal

8｜5621

702-5 first digit

87-6 second place

10-7 third place

1-2 fourth place

Final octal number: 127658

**Decimal system**

For example: 76521 is converted to hexadecimal

16｜76521

4726-5 first (single)

295-6 second place

18-6 third place

1-2 fourth place

Finally, 1276516

**The relationship between binary and hexadecimal**

Binary 0000 0001 0010 0011 0100 0101 0110 0111

Hex 0 1 2 3 4 5 6 7

Binary 1000 1001 1010 1011 1100 1101 1110 1111

Hexadecimal 8 9 A (10) B (11) C (12) d (13) e (14) f (15)

You can use a four digit binary number to represent a hexadecimal number. For example, 3A16 can be converted to binary as follows:

3 is 0011, a is 1010, and the combination is 00111010. The leftmost 0 can be removed to 1110102

Right to convert binary to hexadecimal, you only need to separate the bits of binary by one unit every four bits from right to left, and then compare each unit with the value of hexadecimal.

**The relationship between binary and octal**

Binary 000 001 010 011 100 101 110 111

Octal 0 1 2 3 4 5 6 7

The relationship between binary and octal is similar to the relationship between binary and hexadecimal. Each number of octal is 0 to 7, which is represented by three binary numbers. If you want to convert 51028 to binary, 5 to 101, 1 to 001, 0 to 000, 2 to 010, and combine the binary of these numbers to 1010010000102, that is, the binary value.

If you want to convert binary to octal, separate the bits of binary from right to left by one unit every three bits, and compare the event unit with octal value.