How do you convert a number between decimal and binary?

The number system we use to write numbers is called a positional system. Each digit of the number is a multiplier of the increasing powers of the base. So for binary:
10112 = 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20 To convert the number 10112 to decimal, we simply need to add and multiply:= 8 + 0 + 2 + 1 = 1110 (we usually don't write the base in decimal number, this is just for illustrative purposes.
To convert a decimal number into binary, we use a different method. We take on any decimal number, e.g. 294, and continuously divide it by 2 with a reminder, like so:
294 : 2 = 147 | remainder: 0 - least significant bit (last digit)147 : 2 = 73 | remainder: 173 : 2 = 36 | remainder: 136 : 2 = 18 | remainder: 018 : 2 = 9 | remainder: 09 : 2 = 4 | remainder: 14 : 2 = 2 | remainder: 02 : 2 = 1 | remainder: 01 : 2 = 0 | remainder: 1 - most significant bit (first digit)0
So the decimal number 294 converts to: 1001001102And this holds for all numbers.

Answered by Kacper M. Computing tutor

957 Views

See similar Computing IB tutors

Related Computing IB answers

All answers ▸

Question 14)http://ibdocuments.com/IB%20PAST%20PAPERS%20-%20SUBJECT/Group%204%20-%20The%20sciences/Computer_science_SL/2007%20November%20Examination%20Session/English%20Papers/Computer_science_paper_1_SL.pdf


What is encapsulation?


Name several sort algorithms of an array, their working principles and their efficency.


Define the terms CU and ALU and briefly explain their roles in the CPU.


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2024

Terms & Conditions|Privacy Policy