Home » Digital Electronics

Conversion of Decimal Number System into Hexadecimal Number System

Here, we are going to learn how to convert Decimal Number System into Hexadecimal Number System?
Submitted by Saurabh Gupta, on October 12, 2019

Conversion of decimal number system into hexadecimal number system can be done by successively dividing an integral part by 16 till the quotient is 0 and then reading the remainder of all in the bottom to the top manner, where the bottom one is the MSB and the topmost is the LSB. For fractional part, we successively multiply it by 16 till we get 0 in the fractional part of the product term, the integral part of the product term recorded from top to bottom forms the respective hexadecimal number where topmost is the MSB.

To convert a mixed decimal number into hexadecimal, we will first convert integral and fractional parts into hexadecimal and then combine them.

The only thing to be kept in mind is the digits in hexadecimal number system are as:

1 , 2, 3, 4, 5, 6, 7, 8, 9, 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F

Now let's take examples to understand the conversion of decimal number to hexadecimal number.

Example 1:

Convert (1954.785)10 to ( ? )16

Solution:

Given decimal number (1954.785)10 is of mixed type and contains both integral (1954)10 and decimal part (0.785)10. To convert the given number into hexadecimal, we have to convert integral and fractional part individually into hexadecimal and then combine them together to get the required result.

Integral Part

Divisor Quotient Remainder
161954
161222 LSB
16710 = A
1607 MSB

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (1954)10 = (7A2)16.

Fractional Part

    0.785 * 16 = 12.56 = C.56     (MSB)
    0.56 * 16 = 8.96
    0.96 * 16 = 15.36 = F.36
    0.36 * 16 = 5.76
    0.76 * 16 = 12.16 = C.16    (LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.785)10 = (0.C8F5C)16.

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (1954.785)10 = (7A2.C8F5C)16.

Example 2:

Convert (3283.715)10 to ( ? )16

Solution:

Integral Part

Divisor Quotient Remainder
163283
162053 LSB
161213=D
16012=C MSB

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (3283)10 = (CD3)16.

Fractional Part

    0.715 * 16 = 11.44 = B.44   (MSB)
    0.44 * 16 = 7.04
    0.04 * 16 = 0.64
    0.64 * 16 = 10.24 = A.24    (LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.715)10 = (0. B70A)16.

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (3283.715)10 = (CD3. B70A)16.

Example 3:

Convert (356.225)10 to ( ? )16

Solution:

Integral Part

Divisor Quotient Remainder
16356
16224 LSB
1616
1601 MSB

The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (356)10 = (164)16.

Fractional Part

    0.225 * 16 = 3.600		(MSB)
    0.600 * 16 = 9.600
    0.600 * 16 = 9.600
    0.600 * 16 = 9.600		(LSB)

The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.225)10 = (0.39)16.

After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (356.225)10 = (164.39)16.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.