Decimal to Hexadecimal and Hexadecimal to Decimal Conversion Solved Examples

Conversion Between Decimal and Hexadecimal Numbers
The method of conversion in between hexadecimal and decimal numbers are same as conversion between Octal and decimal numbers. I tried to make explanation as easy as possible. I provide 2 tables, one is for calculated powers of 16 and the other is for hexadecimal numbers equivalent in decimal numbers.

Key Questions:
  • Conversion between decimal and hexadecimal numbers
  • How to convert decimal fraction into hexadecimal fraction
  • How to convert hexadecimal fraction into decimal fraction

164
163
162
161
160
16-1
16-2
65536
4096
256
16
1
0.0625
0.0039


Hexa-decimal
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
Decimal
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15

Decimal to Hexadecimal Conversion:
As we see in decimal to binary conversion and decimal to octal conversion when  converting From decimal to binary number system we use repeated division by 2 and if decimal to octal number system we use repeated division by 8. So this time we are working with hexadecimal numbers so the repeated division by 16 method is used. And if we have mantissa or fractional part then we use repeated multiplication by 16 method. Let's start with examples.


Example#01:4859)10= ?)16

4859/16 =303       remainder 11)10=B)16
303/16= 18           remainder 15)10=F)16
18/16=1                remainder 2)10=2)16
Look at the highlighted numbers 12FB)16
Answer 4859)10= 12FB)16


Example#02:23456.235)10= ?)16
Solve integer part using division by 16
23456/16=1466      remainder 0 =0)16
1466/16=91            remainder 10)10=A)16
91/16=5                  reminder 11)10=B)16
Look at the highlighted numbers  5BA0)16

Mantissa will be calculated by using repeated multiplication by 16

0.235*16=3.76 (most significant digit)
0.76*16=12.16)10=C.12)16
0.16*16=2.56. (least significant digit)

0.235)10=0.3C2)16
Answer 23456.235)10= 5BA0.3C2)16


Example#03:1359.79)10= ?)16

For integer use repeated division by 16
1359/16 =84         remainder 15)10=F)16
84/16= 5                remainder 4

1359)10=54F)16
 For mantissa use repeated multiplication by 16
0.79*16=12.64 = C.64)16
0.64*16=10.24 = A.24)16
0.79)16=0.CA)16
Answer 1359.79)10= 54F.CA)16


Hexadecimal to Decimal Conversion:
As we know when converting from any number system to decimal number system we use sum of weights method. Like for binary numbers the sum of weights are powers of 2. For octal numbers the sum of weights are power of 8. Similarly for hexadecimal numbers the sum of weights are powers of 16.

Example#01: 12FB)16= ?)10
12FB)16=(1*163)+(2*162)+(F*161)+(B*160)
            =(1*4096)+(2*256)+(15*16)+(11*1)
            =4096+512+240+11
            =4859)10
Answer 12FB)16= 4859)10


Example#02: 5BA0.3C2)16= ?)10

5BA0.3C2)16=(5*163)+(B*162)+(A*161)+(0*160)
                        .(3*16-1)+(C*16-2)+(2*16-3)
                      =(5*4096)+(11*256)+(10*16)+(0*1)
                       .(3*0.0625)+(12*0.00390625) 
                         neglect 16-3 which is too small.
                       =20480+5632+160.+0.1875+
                        0.046875
                       =23455.23)10
Answer 5BA0.3C2)16= 4859)10


Example#03:  54F.CA)16= ?)10

54F.CA)16= (5*162)+(4*161)+(F*160).(C*16-1)+
                    (A*16-2)
               =(5*256)+(4*16)+(15*1).+(12*0.625)+
                  .(10*0.0039)
                =1280+64+15.75+0.039
                =1359.79)10
Answer 54F.CA)16= 1359.79)10

Octal Numbers to Decimal Numbers Solved Examples

Octal Numbers to Decimal Numbers Conversion and Decimal Numbers to Octal Numbers Conversion
Before beginning to this topic if you want to learn some basic information about number system you can read it from number system detailed explanation. Again I tried to make this topic easy to understand.

Key Questions:
  • Convert from octal number system to decimal number system
  • Convert from decimal number system to octal number system
  • How to convert decimal fraction into octal fraction
  • How to convert octal fraction into decimal fraction

Decimal to Octal Conversion:
The method of converting decimal number to octal number is same as decimal to binary numbers conversion. The difference is that when converting from decimal to binary we use repeated division by 2. But when converting from decimal to octal we use repeated division by 8. For mantissa calculation we use repeated multiplication by 2 when converting a decimal fraction into binary fraction. The method is explained in decimal to binary conversion. Similarly when working with octal numbers we use repeated multiplication by 8 for mantissa calculation.

Example#01:1899)10=?)8
Repeated division by 8
1899/8 = 237       remainder 3
237/8  = 29          remainder 5
29/8 = 3              remainder 5
Answer 1899)10= 3553)8


Example#02:9876.87)10=?)8
First solve integer part by Repeated division by 8
9876/8 = 1234     remainder 4
1234/8  = 154      remainder 2
154/8 = 19           remainder 2
19/2 = 2               remainder 3
9876)10=23224)8

For mantissa calculation use repeated multiplication by 8 method

0.87*8=6.96 (Most significant digit)
0.96*8=7.68
0.68*8=5.44
0.44*8=3.52 (least significant digit)
Answer  9876.87)10= 23224.6752)8


Example#03: 9248.356)10 = ?)8
Repeated division by 8
9248/8 = 1156    remainder 0
1156/8  = 144      remainder 4
144/8 = 18           remainder 0
18/2 = 2               remainder 2

9248)10=22040)8

For mantissa calculation use repeated multiplication by 8.

0.356*8=2.848 (most significant digit)
0.848*8=6.784
0.784*8=6.272 (least significant digit)
0.356)10=0.266)8
Answer: 9248.356)10 = 22040.266)8

Octal to Decimal Conversation:
When we are converting a number from octal number system to decimal number system we use sum of weights method. The method is same as binary to decimal conversion but the difference is base. For binary numbers system we multiply each digit by power of base 2. That is 2n. You can learn binary to decimal conversion here. Similarly when working on octal number system we use power of base 8. That is 8n. At this point I would like to add a table for calculated values of sum of weights. So it's easy to add a table for quick reference.

84
83
82
81
80
8-1
8-2
8-3
8-4
4096
512
64
8
1
0.125
0.015625
0.001953125
0.000244140625


Example#01:3553)8=?)10
5554)8=(3*83)+(5*82)+(5*81)+(3*80)
          =(5*512)+(5*64)+(5*8)+(3*1)
          =1536+320+40+3
          =1899)10
Answer:  3553)8=1899)10


Example#02: 23224.6752)8=?)10
23224.6752)8=(2*84)+(3*83)+(2*82)+(2*81)+(4*80).(6*8-1)+(7*8-2)+(5*8-3)+(2*8-4)
                      =(2*4096)+(3*512)+(2*64)+(2*8)(4*1).(6*0.125)+(7*0.015625).....Neglect small fractions
                     =8192+1536+128+16+4.0.75+0.109375
                     =9876.86)10
Answer:  23224.6752)8=9876.86)10


Example#03: 22040.266)8 =?)10

22040.266)8=(2*84)+(2*83)+(0*82)+(4*81)+(0*80)+(2*8-1)+(6*8-2)+(6*8-3)
                  =(2*4096)+(2*512)+(0*64)+(4*8)+(0*1).(2*0.125)+(6*0.015625)+(6*0.001953125)
                 =8191+1024+0+32+0.+0.25+0.09375+ 0.012
                =9248.36)10
Answer:  22040.266)8=9248.36)10

Decimal to Binary and Binary to Decimal Conversation Solved Examples

Decimal to Binary and Binary to Decimal Conversion Using Sum of Weights Method and Division by 2 Method

Decimal to Binary and Binary to Decimal Conversation Solved Examples:

This topic is in continuation of number system. I will explain and provide some solved examples how to convert from binary to decimal and decimal to binary.
It is very easy and interesting topic. Anyone can understand easily

Key Questions

How to convert binary numbers into decimal numbers?
How to convert fractional binary numbers into equivalent decimal numbers?
How to convert from decimal to binary by sum of weights method?
How to convert from decimal to binary by 'Division by-2’ method?
Conversions of fractional decimal numbers


Table for sum of weights method
26
64
25
32
24
16
23
8
22
4
21
2
20
1
2-1
0.5
2-2
0.25
2-3
0.125
2-4
0.0625
2-5
0.03125
2-6
0.015625

Binary to Decimal Conversation:

Multiply each bit by its weight and add all of them.

Example#01: 1001110)2=?)10

1001110)2=(1*26)+(0*25)+(0*24)+(1*23)+(1*22.)+(1*21)+(0*20)
              =(1*64)+(0*32)+(0*16)+(1*8)+ (1*4) +(1*2)+(0*1)
                =64+0+0+8+4+2
                =78)10
Answer  1001110)2=78)10



Example#02: 1101110)2=?)10

1101110)2=(1*26)+(1*25)+(0*24)+(1*23)+(1*22)+(1*21)+(0*20)
                =(1*64)+(1*32)+(0*16)+(1*8)+ (1*4)+(1*2)+(0*1)
                 =64+32+0+8+4+2+0
                 =110)10
Answer 1101110)2=110)10



Example#03:1011100.01110)2

1011100.01110)2=(1*26)+(0*25)+(1*24)+(1*23)+(1*22)+(0*21)+(0*20).(0*2-1)+(1*2-2)+(1*2-3)+(1*2-4)+(0*2-5)
               =(1*64)+(0*32)+(1*16)+(1*8)+(1*4)+(0*2)+(0*1).(0*0.5)+(1*0.25)+(1*0.125)+(1*0.0625)+(0*0.03125)
=64+16+8+4.0.25+0.125+0.0625
Answer 1011100.01110)2=92.4375)10



Example#04:1011001.10101)2=?)10

1011001.10101)2= (1*26)+(0*25)+(1*24)+(1*23)+(0*22)+(0*21)+(1*20).(1*2-1)+(0*2-2)+(1*2-3)+(0*2-4)+(1*2-5)
                           =(1*64)+(0*32)+(1*16)+(1*8)+(0*4)+(0*2)+(1*1).(1*0.5)+(0*0.25)+(1*0.125)+(1*0.0625)+(1*0.013625)
                  =64+16+8+1.0.5+0.125+0.013625
                         = 89.6562)10

Answer 1011001.10101)=89.6562)10




Decimal to Binary Conversation:

There are two different methods of decimal to binary conversation.
  • Sum of weights method
  • Division by 2 method
The sum of weights method might be confusing. So to avoid confusion and make things clear and easy please refer table above.

Example#01: 78)10=?)2

Division by 2 Method (Decimal To Binary Conversion):

78/2=39    remainder 0
39/2=19    remainder 1
19/2=9      remainder 1
9/2=4        remainder 1
4/2=2        remainder 0
2/2=1        remainder 0

Rewrite the bold numbers, start from bottom 1001110)2

Sum of Weights Method (Decimal To Binary Conversion):
78 = 64+8+4+2
78 = 26+23+22+21
It can also be written as
     =26 +23+22+21  

Carefully looking at the above expression. Sum weights  that are present.. at the place 6, at the  place 3,at the place 2 and at the place 1. Assign binary 1 at these places.
Sum of weights that are absent.. at the place 0, at the place 4, at the place 5. There is no 20,24,25. Assign binary 0 at these places.

26
25
24
23
22
21
20
Present
Absent
Absent
Present
Present
Present
Absent
1
0
0
1
1
1
0


Answer: 78)2=1001110)2



Example#02: 110)10=?)2
Division by 2 Method:
110/2=55    remainder 0
55/2=27      remainder 1
27/2=13      remainder 1
13/2=6        remainder 1
6/2=3          remainder 0
3/2=1          remainder 1

Rewrite the bold numbers, start from bottom 1101110)2

Sum of Weights Method:
110)10=64+32+8+4+2
         =26+25+23+22+21
                =1101110)2

26
25
24
23
22
21
20
Present
Present
Absent
Present
Present
Present
Absent
1
1
0
1
1
1
0
Answer: 110)10=1101110)2



Example#03: 92.4646)10=?)2
The integer part can either be solved by sum of weights method or division by-2 method. While fractional part will be solved by some other technique.

Integer part will be solved by division by 2 method, while mantissa is solved by repeated multiplication by 2.

Division by 2 Method:
92/2=46      remainder 0
46/2=23      remainder 0
23/2=11      remainder 1
11/2=5        remainder 1
5/2=2          remainder 1
2/2=1          remainder 0

Integer =92)10=1011100)2
Mantissa =0.4646

Mantissa will be solved by repeated multiplication by 2
Multiply 0.4646 by 2. Again pick the resultant mantissa and multiply it by 2. Again pick the mantissa and multiply it by 2. Repeat until the mantissa becomes zero or desired number of places after binary point is achieved.

0.4646*2=0.9292 (MSB)
0.9292*2=1.8584
0.8584*2=1.7186
0.7186*2=1.4336
0.4336*2=0.8672 (LSB)
0.4646)10=01110)2

Answer 92.4646)10=1011100.01110)2

Solved by sum of weights method:
92)10=64+16+8+4
      =26+24+23+22
      =1011100)2
0.4646)10=0.25+0.125+0.0625
              =2-2+2-3+2-4
              =0.01110)2

26
25
24
23
22
21
20
2-1
2-2
2-3
2-4
2-5
Present
Absent
Present
Present
Absent
Absent
Absent
Present
Absent
Present
Absent
Present
1
0
1
1
1
0
0
0
1
1
1
0

Answer 92.4646)10=1011100.01110)2


Example#04: 89.6785)10=?)2
Division by 2 Method:
89/2=44      remainder 1
44/2=22      remainder 0
22/2=11      remainder 0
11/2=5        remainder 1
5/2=2          remainder 1
2/2=1          remainder 0
89)10=1011001)2

Mantissa will be calculated by repeated multiplication by 2:

0.6785*2=1.357 (MSB)
0.357*2=0.714
0.714*2=1.428
0.428*2=0.856
0.856*2=1.712 (LSB)
0.6785)10=0.10101)2

Answer 89.6785)10=1011001.10101)2

Sum of weights method:
Refer table for sum of weights.

89)10=64+16+8+1
       =26+24+23+20
       =1011001)2
0.6785)10=0.5+0.125+0.03125
              =2-1+2-3+2-5
              =0.10101)2
26
25
24
23
22
21
20
2-1
2-2
2-3
2-4
2-5
Present
Absent
Present
Present
Absent
Absent
Absent
Present
Absent
Present
Absent
Present
1
1
0
1
1
1
0
1
0
1
0
1

Answer 89.6785)10=1011001.10101)2

Popular Posts