Binary CS Thinking Example 1
Follow the full solution, then compare it with the other examples linked below.
Example 1
mediumConvert the decimal number 45 to binary.
Solution
- 1 Step 1: 45 รท 2 = 22 remainder 1.
- 2 Step 2: 22 รท 2 = 11 r0. 11 รท 2 = 5 r1. 5 รท 2 = 2 r1. 2 รท 2 = 1 r0. 1 รท 2 = 0 r1.
- 3 Step 3: Read remainders bottom to top: 101101.
Answer
Binary (base 2) uses only digits 0 and 1. Repeatedly dividing by 2 and collecting remainders converts decimal to binary. Computers use binary because electronic circuits have two states: on and off.
About Binary
Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values. Each digit position represents a power of 2, and computers use binary because electronic circuits have exactly two states: on and off.
Learn more about Binary โ