As you know, in computers numbers are written in binary form, and it is more convenient for a person to use decimal numbers.
Translation of numbers from binary code to decimal representation produces, as a rule, the corresponding programs.
However, programmers often have to work with numbers in their immediate, "machine" form.
In this case, the decimal numbers are converted to a hexadecimal number system, understandable to both the computer and the specialist.
You will need
- - calculator-
- - a computer.
To convert a number from the decimal system toUse the standard Windows calculator to use hexadecimal. Only the calculator should be used not in the standard, but in the "engineering" form. To do this, select the "View" main menu item and click on the "Engineering" line.
Pay attention to the mode in which it workscalculator. Typically, this is the decimal mode of representing numbers, set by default. If the pointer is not located in the Dec position, then set it to this position.
Now just type in the computer keyboard(Or the virtual keyboard of the calculator) a decimal number that must be converted to a hexadecimal representation. Note that the number can not be very large - no more than 18446744073709551615. Although the calculator display allows you to enter more "long" numbers, when converting to a hexadecimal form, the "extra" digits will be discarded and the result will turn out to be wrong.
Having typed the initial (decimal) number, switchCalculator in hexadecimal mode. To do this, move the digit number to Hex. The entered number is automatically converted to a hexadecimal form. The hexadecimal number representation pointer should be in the "8 byte" position, otherwise the length of the input numbers will be very limited (for example, for "1 byte" - not more than 255).
If there is no computer, you can translate the number fromDecimal to hexadecimal and "manually". To do this, divide the decimal number by 16. And, you need to divide classically - "corner", so that the remainder is in the form of an integer, and not in the form of a "tail" of a decimal fraction.
So, by dividing the original number by 16, write downThe remainder as the low (right) digit of the hexadecimal number. If the remainder is greater than 9, convert it to a "real" hexadecimal form. Note that the decimal number 10 corresponds to the hexadecimal "A", etc. In order not to be mistaken, use the following table:
10 - A
11 - B
12 - С
13 - D
14 - E
15 - F
If the quotient of the original number by 16It turned out to be greater than 0, then again repeat the previous step, taking the quotient as the dividend. The remainder of the division, converted to a hexadecimal digit, is written sequentially from right to left. Repeat the process until the quotient is zero.