Just like you divide this 18 by 2 repeatedly to form a decimal representation for it, you need to do the reverse to convert the decimal part of the number to binary. You need to multiply that decimal portion of the number by 2 repeatedly until it gives a standalone digit. The result(product) of the first multiplication will be the input to the second multiplication and this continues until we reach a stagnant steady integer value.
So, in your case, the 18.25’s decimal part is 0.25.
Let’s begin by multiplying it with 2.
0.25*2=0.5 // 0
0.5*2=1.0 // 1
Hunt finishes as we end up with the product coming as a standalone integer.
Also, the decimal to binary conversion of 18 is (10010)base 2
. This you can easily calculate as you know it,mentioned in the question.
Hence, the decimal representation for 18.25 will be (10010.01)base 2
—see,serially 01 in the order unlike the numbers where we traverse from bottom to top!
I hope it is clear.
0
solved How to convert decimal to binary?