answersLogoWhite

0

How to convert decimal to binary?

User Avatar

Anonymous

13y ago
Updated: 10/17/2024

This method works for any base, so just replace any 2's in my arithmatic with the other base to make it work for say, base 5.

Consider we have the number 21 base 10 to convert into base 2.

I use a method of remainders, which will give me digits right to left.

21/2 is 10 remainder 1, meaning the last digit is 1, with our number right now being

_ _ _ _ _ 1.

We have 10, which we divide by 2, getting 5 rem. 0, giving us _ _ _ _ 0 1.

We have 5, which we divide by 2, getting 2 rem. 1, giving us _ _ _ 1 0 1.

We have 2, which we divide by 2, getting 1 rem. 0, giving us _ _ 0 1 0 1.

We have 1, which we divide by 2, getting 0 rem. 1, giving us _ 1 0 1 0 1.

This works for any base, and also, once the whole number after dividing reaches zero, such as with the last step, we can quit, because it would just give us a strand of irrelevant zeroes to the left of the answer.

User Avatar

Wiki User

13y ago

What else can I help you with?