0% found this document useful (0 votes)
116 views

Lesson (4) Decimal To Binary

1. The document discusses converting decimal numbers to binary numbers. It provides examples and step-by-step processes for converting 20, 161, and 32 to binary. 2. The largest binary number that can be represented with 8 bits is 255, represented as 11111111 in binary. The smallest is 0, represented as 00000000. 3. When adding two binary numbers results in a number greater than 255, it causes an overflow error since 8 bits can only represent numbers up to 255. An example is provided showing overflow in binary addition.

Uploaded by

Rawia Abu Amr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

Lesson (4) Decimal To Binary

1. The document discusses converting decimal numbers to binary numbers. It provides examples and step-by-step processes for converting 20, 161, and 32 to binary. 2. The largest binary number that can be represented with 8 bits is 255, represented as 11111111 in binary. The smallest is 0, represented as 00000000. 3. When adding two binary numbers results in a number greater than 255, it causes an overflow error since 8 bits can only represent numbers up to 255. An example is provided showing overflow in binary addition.

Uploaded by

Rawia Abu Amr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

14/9/2022

1.4 Decimal to binary

Grade 7
Convert Decimal to binary
 Example: convert 20 to binary
 Step.1 (Draw the grid with the place values of binary )
Place value 128s 64s 32s 16s 8s 4s 2s units

 Step.2 (start from the left and do the operation


20-128 =?
20 is smaller than 128 so we put 0 in 128s place value

Place value 128s 64s 32s 16s 8s 4s 2s units


0
 Step.3 (repeat step.2 for 64s and 32s place values)
20-64=?
20-32=?
20 is smaller than 64 so we put 0 in 64s /20 is smaller than 32 so we put 0 in 32s

Place value 128s 64s 32s 16s 8s 4s 2s units


0 0 0
 Example: convert 20 to binary
 Step.4 (repeat step.2 for 16s )
20-16 =4
20 is bigger than 16 so we put 1 in 16s place value
Place value 128s 64s 32s 16s 8s 4s 2s units
0 0 0 1
 Step.5 (repeat step.2 for 8s place value but for the 4 now not for 20)
4-8=?
4 is smaller than 8 so we put 0 in 8s
Place value 128s 64s 32s 16s 8s 4s 2s units
0 0 0 1 0
 Step.6 (repeat step.2 for 4s place value but for the 4 now not for 20)
4-4=?
4 is equal to 4 so we put 1 in 4s
Place value 128s 64s 32s 16s 8s 4s 2s units
0 0 0 1 0 1 0 0
 Step.7 (Now no more remaining in the 20, so we just fill zeros in the empty places
20 in decimal is 00010100 in binary
 Example: convert 161 to binary
 Step.1 (Draw the grid with the place values of binary )
Place value 128s 64s 32s 16s 8s 4s 2s units

 Step.2 (start from the left and do the operation


161-128 =37
161 is bigger than 128 so we put 1 in 128s place value
Place value 128s 64s 32s 16s 8s 4s 2s units
1

 Step.5 (repeat step.2 for 64s place value but for the 37 now not for 161)
37-64=?
Place value 128s 64s 32s 16s 8s 4s 2s units
1 0 1
37-32=5
Place value 128s 64s 32s 16s 8s 4s 2s units 5-16=?
1 0 1 0 0 1 0 1 5-8=?
5-4=1
1-2=?
161 in decimal is 10100101 in binary 1-1=0
Activity ((a)Page 19)

32-128=?
32-64=?
32-32=0
0-16=?
0-8=?
0-4=?
0-2=?
0-1=?

Place value 128s 64s 32s 16s 8s 4s 2s units


0 0 1 0 0 0 0 0

32 in decimal is 00100000 in binary


The largest Binary number (byte)
128+64+32+16+8+4+2+1=255

Place value 128s 64s 32s 16s 8s 4s 2s units


1 1 1 1 1 1 1 1

The smallest Binary number

Place value 128s 64s 32s 16s 8s 4s 2s units


0 0 0 0 0 0 0 0

 The computer needs to use more than a byte to store


( number bigger than 255, decimal values, and negative numbers )

 In this unit, we will only work with numbers from 0 to 255


Activity (Page 20)
Over flow error

When we have a number bigger than 255

Place value 128s 64s 32s 16s 8s 4s 2s units


No.1 1 0 1 1 1 0 0 1
No.2 0 1 1 0 0 0 0 0
Carry 1 1 0 0 0 0 0 0
Sum 0 0 0 1 1 0 0 1
1.4 Test (page 21)
 Q1: convert the decimal number 67 to binary
67-128=?
67-64=3
3-32=?
3-16=?
3-8=?
3-4=?
3-2=1
1-1=0
Place value 128s 64s 32s 16s 8s 4s 2s units
0 1 0 0 0 0 1 1

 Q2: what is the largest decimal number that can be


shown using 8 bits
255
 Q3: complete the following binary addition showing the overflow error
01011100+11001000

Place value 128s 64s 32s 16s 8s 4s 2s units


Number.1 0 1 0 1 1 1 0 0
Number.2 1 1 0 0 1 0 0 0
=
Carry 1 0 1 1 0 0 0
Sum 0 0 1 0 0 1 0 0
 Q4: convert 120 and 150 to binary then add them and show the overflow
Place value 128s 64s 32s 16s 8s 4s 2s units
150 1 0 0 1 0 1 1 0
120 0 1 1 1 1 0 0 0
=
Carry 1 1 1 0 0 0 0
Sum 0 0 1 0 1 1 1 0

You might also like