In: Computer Science
How to convert 12345 from base 10 to base 2?
Please find the answer below::
To convert a number from decimal to binary, divide the number by 2 until the quotient is not the zero. Write a reminder to the side at each step.
12345 divide by 2 quotient is 6172 and reminder is 1
6172 divide by 2 quotient is 3086 and reminder is 0
3086 divide by 2 quotient is 1543 and reminder is 0
1543 divide by 2 quotient is 771 and reminder is 1
771 divide by 2 quotient is 385 and reminder is 1
385 divide by 2 quotient is 192 and reminder is 1
192 divide by 2 quotient is 96 and reminder is 0
96 divide by 2 quotient is 48 and reminder is 0
48 divide by 2 quotient is 24 and reminder is 0
24 divide by 2 quotient is 12 and reminder is 0
12 divide by 2 quotient is 6 and reminder is 0
6 divide by 2 quotient is 3 and reminder is 0
3 divide by 2 quotient is 1 and reminder is 1
1 divide by 2 quotient is 0 and reminder is 1
Now write reminder from bottom to up it will be . 11000000111001
Hence 12345 in decimal will be 11000000111001 in binary