One of my course assignments it to be able to convert between decimal and binary.
One of the questions is convert 42.25 from Decimal to Binary

I get the answer 10101010 but i'm not sure if im right as i checked it on the internet and got the answer 101010.

for some reason i have 2 extra digits can anyone point me in the right direction.

any help would be much appreciated

Thanks Liam

First of all, it's rounded to 42.

think about the values of binary:

32  16  8  4  2  1 
1   0   1  0  1  0

That should kind of show you what's going on. If you've got any questions, let me know. For your reference, 10101010 is equal to 170.

If you use Windows calculator, in Scientific mode, it allows you to convert decimal (dec) to binary (bin) via the check boxes. Useful to check you answers.

One of my course assignments it to be able to convert between decimal and binary.
One of the questions is convert 42.25 from Decimal to Binary

I get the answer 10101010 but i'm not sure if im right as i checked it on the internet and got the answer 101010.

for some reason i have 2 extra digits can anyone point me in the right direction.

any help would be much appreciated

Thanks Liam

Hi Liam
I m maunty .I have a formula for converting any decimal number to binary . You can use this formula.that is 8421 if you have no 15 the use of formula


8+4+2+1=15 in this formula i use all the numbers of formula. the binary number is 1 1 1 1,because
8 4 2 1
1 1 1 1
other example
9
in no 8421 the combination of 9 is 8+1=9
the binary would be 1 0 0 1
84 2 1

hai friend,
the way to convert a decimal to bianary is:
convert the integral part to binary: binary of 42=101010
method of converting the decimal part:
multiply the decimal by 2 & take the integral part
.25*2=.5 0
.5*2=1.00 1
process terminates when decimal part turns to 0
ans=101010.01
if you are not satisfy with answer
mail me papu_sandip@rediffmail.com

Converting decimal to binary

To convert decimal to binary is also very simple, you simply divide the decimal value by 2 and then write down the remainder, repeat this process until you cannot divide by 2 anymore, for example let's take the decimal value 157:
157 ÷ 2 = 78 with a remainder of 1
78 ÷ 2 = 39 with a remainder of 0
39 ÷ 2 = 19 with a remainder of 1
19 ÷ 2 = 9 with a remainder of 1
9 ÷ 2 = 4 with a remainder of 1
4 ÷ 2 = 2 with a remainder of 0
2 ÷ 2 = 1 with a remainder of 0
1 ÷ 2 = 0 with a remainder of 1

Next write down the value of the remainders from bottom to top (in other words write down the bottom remainder first and work your way up the list) which gives:

10011101 = 157

Convert Binary to Decimal
Binary 1 1 0 0 1 0 1 0
Formula 1X128 1X64 0X16 0X16 1X8 0X4 1X2 0X0
Decimal 128 64 0 0 8 0 2 0

Decimal No- is 128+64+0+0+8+0+2+0 = 202

I think the Original poster kinda figured out the problem in the 4 years since he posted this question.

One of my course assignments it to be able to convert between decimal and binary.
One of the questions is convert 42.25 from Decimal to Binary

I get the answer 10101010 but i'm not sure if im right as i checked it on the internet and got the answer 101010.

for some reason i have 2 extra digits can anyone point me in the right direction.

any help would be much appreciated

Thanks Liam

decimal no-42.25 of Binary is 101010.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.