Computer Science, asked by chintumanojb1507, 1 year ago

How to directly convert from binary to hexadecimal?

Answers

Answered by Anonymous
4
1
Find a line of up to four binary numbers to convert. Binary numbers can only be 1 and 0. Hexadecimal numbers can be 0-9, or A-F, since hexadecimal is base-16. You can convert any binary string to hexadecimal (1, 01, 101101, etc.), but you need four numbers to make the conversion (0101→5; 1100→C, etc.). For this lesson, start with the example 1010.
1010
If you don't have 4 digits, add zeros to the front to make it four digits. So, 01 would become 0001

2

Write a small "1" above the last digit.Each of the four numbers signifies a type of number decimal system number. The last digit is the one's place. You will make sense of the rest of the digits in the next step. For now, write a small one above the last digit.

1010

1010^{1}

Note that you are not raising anything to any power -- this is just a way to see what digit means what.

3

Write a small "2" above the third digit, a "4" above the second, and an "8" above the first. These are the rest of your place holders. If you're curious, this is because each digit represents a different power of 2. The first is 2^{3}, the second 2^{2}, etc.

1010

1^{8}0^{4}1^{2}0^{1}

4

Count out how many of each "place" you have. Luckily, this conversion is easy once you have four numbers and know what they all mean. If you have a one in the first number, you have one eight. If you have a zero in the second column, you have no fours. The third column tells you how many twos, and the second how many ones. So, for our example:

1010

1^{8}0^{4}1^{2}0^{1}

8 0 2 0

5

Add your four numbers together. Once you have your new hexadecimal numbers, simply add them up.

1010

1^{8}0^{4}1^{2}0^{1}

8 0 2 0

8+0+2+0=10

Final answer: The binary number 1010 converts to A in the hexadecimal system.

I hope this may be helpful to you
Similar questions