## Pages

### Number conversion

As we have already learned in the previous topic, theoretically there can exist and infinite number of bases as any positive number can be made into a base. But for today we’ll only be focusing on 3 types of bases which are binary, decimal and hexadecimal. As the title stated, we are going to learn about the conversion of a number betweean bases. Lets say you are given a decimal number with value 10, you can turn it into a binary number or  a hexadecimal number. Therefore, we’re here to share with you on the how to? that you have been wondering  about.

Part 1: Converting a decimal number into a binary and vice versa

Example 1:
Given a decimal number with value 15, convert the given number into binary digit of 8-bits.

Step 1: Do a table which reads from right to left with number 2 as the base number.

 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 128 64 32 16 8 4 2 1

Side Note: The “^” sign is the power sign for those of you who didn’t know about it. Thus, it is read as
2 to the power of 0 and ect.

Step 2: For each of the column insert ones and multiply them with the upper row number to get a total of 15.

The rest of the column is filled zeros

 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 128 64 32 16 8 4 2 1 0 0 0 0 1 1 1 1

Step 3: Write the answer according to the number of bits asked in the question.

Therefore, the answer to example 1 is  00001111.

Example2:

Given a binary number of value 10010010. Convert the following number to a decimal number.

Step 1: Build a table just like in example 1.

 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 128 64 32 16 8 4 2 1

Step 2: For each bit from left to right, fill it in the table in the same order(left to right).

 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 128 64 32 16 8 4 2 1 1 0 0 1 0 0 1 0

Step 3: Multiply the bits with the upper row and add all of the numbers to get the answer.

= 146

Thus, that concludes part 1 of today’s topic. Next, we’re going to convert numbers involving the hexadecimal system.

Part 2: Converting decimal to hexadecimal number and vice versa.

Example 1:

Given a decimal number with value 273. Convert the following number into a hexadecimal number.

Step 1: Build a table.

 16^4 16^3 16^2 16^1 16^0 65536 4096 256 16 1

Step2: Insert the numbers in their proper column.

 16^4 16^3 16^2 16^1 16^0 65536 4096 256 16 1 0 0 1 1 1

Example 2:

Given 3FEA. Convert the following number into a decimal number.

Step 1: Define the alphabets.
A = 10, E = 14, F = 15, 3 = 3

Step 2: Build a table with base 16.

 16^3 16^2 16^1 16^0 4096 256 16 1 3 15 14 10

Step 3: Multiply the numbers with the upper row and add them together to get the value.

Answer = (3*4096) + (15*256) + (14*16) + (10*1)
= 16362

Part 3: Converting a hexadecimal number to binary digits and vice versa

Example 1:

Given FEA31. Convert the following hexadecimal number to binary digits.

Step 1: Convert each characters to their respective binary digits.

F = 15, E = 13, A = 10, 3 = 3, 1 = 1

 2^4 2^3 2^2 2^1 2^0

F = 15 = 1111, E = 14 = 1110, A = 10 = 1010, 3 = 3 = 0011, 1 = 1 = 0001

PS: You can refer to the table given for easier conversion.

Example 2:

Given 1110111100011010. Convert the following to its hexadecimal number system.

Step 1: Split the digits to 4-bit each.
1110 1111 0001 1010
(a)     (b)    (c)     (d)

Step 2: For each (a), (b), (c) and (d) refer to the table given or convert them into hexa numbers using
the table formula.

 16^3 16^2 16^1 16^0