CHP 1
NUMBER SYSTEMS AND CODES
[C3; CLO1; LD1,LD2] [Type text] [Type text]
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
INTRODUCTION
Many number systems are in use in digital technology. The most common are the
decimal, binary, octal, and hexadecimal systems. The decimal system is clearly the most familiar
because it is a tool that we use every day.
DECIMAL NUMBER SYSTEM
The position of each digit in a weighted number system is assigned a weight based on the
base or radix of the system.
The radix of decimal numbers is ten, because only ten symbols are used to represent any
number that is 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Decimal number examples :
o 43610
o 72.310
o 102010
The column weights of decimal numbers are powers of ten that increase from right to left -
beginning with 100 = 1.
…105 104 103 102 101 100.
For fractional decimal numbers, the column weights are negative powers of ten that
decrease from left to right:
102 101 100. 10-1 10-2 10-3 10-4 …
Decimal numbers can be expressed as the sum of the products of each digit times the
column value for that digit. Thus, the numbers 125010 and 73.410 can be expressed as :
125010 = (1x103) + (2x102) + (5x101) + (0x100)
= 1000 + 200 + 50 + 0
= 125010
73.4110 = (7x101) + (3x100) + (4x10-1) + (1x10-2)
= 70 + 3 + 0.4 + 0.01
= 73.4110
2
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
BINARY NUMBER SYSTEM
In digital systems the information that is being processed is usually presented in binary
form.
Binary quantities can be represented by any device that has only two operating states or
possible conditions. For example a switch is only open or closed.
Binary has a base of two and uses the digits 0 and 1 to represent quantities.
Binary number examples :
10102
1110.1112
111100002
The column weights of binary numbers are positive powers of two that increase from right
to left beginning with 20 =1:
…25 24 23 22 21 20.
For fractional binary numbers, the column weights are negative powers of two that
decrease from left to right:
22 21 20. 2-1 2-2 2-3 2-4 …
A binary counting sequence for numbers from zero to fifteen is shown in Table 1 below.
Table 1: Decimal to binary
Decimal Number Binary Number
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
3
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Decimal Number Binary Number
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
BINARY CODED DECIMAL (BCD) 8421 SYSTEM
The binary coded decimal system is used to represent each of the 10 decimal digits as a
4-bit binary code.
This code is useful for outputting to displays that are always numeric (0 to 9) such as
those found in digital clocks or digital voltmeters.
Technique: Convert each decimal digit to its 4 bit binary code.
Table 2 below illustrates the difference between straight binary and BCD.
BCD represents each decimal digit with a 4-bit code.
Notice that the codes 1010 through 1111 are not used in BCD.
Table 2: BCD Table
DECIMAL BCD BINARY
0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 0001 0000 1010
11 0001 0001 1011
12 0001 0010 1100
13 0001 0011 1101
14 0001 0100 1110
15 0001 0101 1111
4
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
CONVERSION AMONG BASES
QUICK EXAMPLE: 2510 = 110012 = 318 = 1916
(I) BINARY TO DECIMAL CONVERSION
Any binary number can be converted to its decimal equivalent simply by summing
together the weights of the various positions in the binary number which contain a bit 1.
Example 1: Convert the binary number 110112 to decimal.
Solution: Write down column weights until the last number is larger than the one you
want to convert.
110012 = (1x20) + (1x23) + (1x24)
= (1 + 8 + 16)
= 2510
Example 2: Convert the binary number 100101.01 to decimal.
Solution:
100101.012 = (1x20) + (1x22) + (1x25) + (1x2-2)
= (1 + 4 + 32 + 0.25)
= 37.2510
EXERCISE
Try This!
Convert 0011.112 to decimal
5
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
(II) DECIMAL TO BINARY CONVERSION
There are 2 methods:
(I) Reverse of Binary-To-Digital Method
Example 1 :Convert 4510 to binary
4510 = 32 + 0 + 8 + 4 + 0 + 1
= 25 + 0 + 23 + 22 + 0 + 20
= 1011012
(II) Repeat Division
This method uses repeated division by 2.
Technique:
Divide by two, keep track of the remainder
First remainder is LSB, least-significant bit
Last remainder is bit MSB, Most Significant Bit
Example 1: Convert 2510 to binary
Solution:
25/2 = 12 + remainder of 1 1 (Least Significant Bit)
12/2 = 6 + remainder of 0 0
6/2 = 3 + remainder of 0 0
3/2 = 1 + remainder of 1 1
1/2 = 0 + remainder of 1 1 (Most Significant Bit)
Answer: 2510 = 110012
A decimal fraction number can be converted to binary number by repeatedly multiplying
the fractional number by 2.The carries form the binary number.
Example 1: Convert 0.18810 to binary
Solution:
0.188 x 2 = 0.376 carry = 0 (Most Significant Bit)
0.376 x 2 = 0.752 carry = 0
0.752 x 2 = 1.504 carry = 1
0.504 x 2 = 1.008 carry = 1
0.008 x 2 = 0.016 carry = 0 (Least Significant Bit)
6
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Answer = 0.00110 (for five significant digits)
Example 2: Convert 12.812510 to binary 0 (Least Significant Bit)
Solution: 0
12/2 = 6 + remainder of 0 1
6/2 = 3 + remainder of 0 1 (Most Significant Bit)
3/2 = 1 +remainder of 1
1/2 = 0 + remainder of 1
Result : 1210 = 11002
Solution: = 1.625 carry 1
= 1.25 carry 1
0.8125 x 2 = 0.50 carry 0
0.625 x 2 = 1.00 carry 1
0.25 x 2
0.50 x 2
Result : 0.812510 = 0.11012
Answer: 12.812510 = 1100.11012
EXERCISE
Let’s Do This!
Convert 24.3710 to binary.
OCTAL NUMBER SYSTEM
The octal number system has a base of eight, meaning that it has eight possible
digits : 0,1,2,3,4,5,6,7.
Octal is also a weighted number system. The column weights are positive powers of
eight, which increase from right to left.
7
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
…84 83 82 81 80.
For fractional octal numbers, the column weights are negative powers of eight that
decrease from left to right:
82 81 80. 8-1 8-2 8-3 8-4 …
(III) OCTAL TO BINARY CONVERSION
Each Octal digit is represented by three binary digits.
Technique :
Convert each octal digit to a 3-bit equivalent binary representation
Example 1 : Convert 358 to binary
Solution: 3 5
011 101
So, 358 = 0111012
Example 2 : Convert 27.358 to binary
Solution: 2 7 .3 5
010 111 . 011 101
So, 27.358 = 010111.0111012
EXERCISE
Convert 46.5328 to binary.
Let’s Try!
8
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
(VI) BINARY TO OCTAL CONVERSION
Technique :
Group bits in threes, starting on right
Convert to octal digits
Example 1: Convert 1001110102 to octal
Solution: 100 111 010
472
So, 1001110102 = 4728
Example 2: Convert 10110101112 to octal.
Solution: 001 011 010 111
1 327
So, 10110101112 = 13278
Example 3: Convert 1101011.10112 to octal.
Solution: 001 101 011 . 101 100
15 3. 5 4
So, 1101011.10112 = 153.548
EXERCISE
Convert 010110101.0112 to octal.
Let’s Try!
9
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
(V) OCTAL TO DECIMAL CONVERSION
• Technique
– Multiply each bit by 8n, where n is the “weight” of the bit
– The weight is the position of the bit, starting from 0 on the right
– Add the results
Example 1: Convert 2378 to decimal.
Solution: 2378 = (2 x 82) + (3 x 81) + (7 x 80)
= 148 + 24 + 7
= 15910
Example 2 : Convert 12.38 to decimal
Solution: 12.38 = 1 x (81) + 2 x (80) + 3 x (8-1)
= 8 + 2 + 0.375
= 10.37510
EXERCISE
Let’s Do This!
Convert 67.318 to decimal
(VI) DECIMAL TO OCTAL CONVERSION
Repeat Division
This method uses repeated division by 8.
Technique :
Divide by eight, keep track of the remainder
First remainder is LSB, least-significant bit
Last remainder is bit MSB, Most Significant Bit
10
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Example 1: Convert 17710 to octal (Least significant Bit)
(Most Significant Bit)
Solution:
177/8 = 22 remainder 1
22/8 = 2 remainder 6
2/8 = 0 remainder 2
Result: 17710 = 2618
A decimal fraction number can be converted to octal number by repeatedly multiplying
the fractional number by 8.
Example 1: Convert 172.35110 to octal
Solution:
172/8 = 21 remainder 4 (Least Significant Bit)
21/8 = 2 remainder 5
2/8 = 0 remainder 2 (Most Significant Bit)
Result: 17210 = 2548
0.351 x 8 = 2.808 carry 2
0.808 x 8 = 6.464 carry 6
0.464 x 8 = 3.712 carry 3
Result: 0.35110 = 2638
Answer: 172.35110 = 254.2638
EXERCISE
Try This!
Convert 212.3410 to octal
11
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
HEXADECIMAL NUMBER SYSTEM
The hexadecimal number system uses base 16.
Thus, it has 16 possible digit symbols. It uses the digits 0 through 9 and the alphabetic
letters A, B, C, D, E, and F as the 16 digit symbols.
Hexadecimal is also a weighted number system. The column weights are positive powers
of 16, which increase from right to left.
…164 163 162 161 160.
For fractional hexadecimal numbers, the column weights are negative powers of 16 that
decrease from left to right:
162 161 160. 16-1 16-2 16-3 16-4 …
(VII) HEXADECIMAL TO BINARY CONVERSION
Each Hexadecimal digit is represented by four binary digits.
Technique
Convert each hexadecimal digit to a 4-bit equivalent binary representation
Example 1: Convert 10AF16 to binary.
Solution: 1 0A F
0001 0000 1010 1111
Answer: 10AF16 = 00010000101011112
Example 2: Convert 27.3516 to binary
Solution:
2 7. 3 5
0010 0111 . 0011 0101
Answer: 27.3516 = 00100111.001101012
12
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
EXERCISE
Let’s Do This!
Convert EC2.5516 to binary
(VIII) BINARY TO HEXADECIMAL CONVERSION
Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
Example 1: Express 1011001011112 in hexadecimal
Solution: 1011 0010 11112
= (1011) (0010) (1111)2
= B2F16
Example 2: Convert 1001011.11012 to hexadecimal
Solution: 0100 1011 . 1101
4 B. D
= 4B.D16
EXERCISE
Express 0011011110.001102 in
hexadecimal.
Let’s Do This!
13
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
(IX) HEXADECIMAL TO DECIMAL CONVERSION
Technique
Multiply each bit by 16n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
Example 1: Convert ABC16 to decimal
Solution: (A x 162) + (Bx161) + (Cx160)
= 2560 + 176 + 12
= 274810
Example 2: Convert 24.616 to decimal
Solution: (2 x 161) + (4 x 160) + (6 x 16-1)
= 32 + 4 + 0.375
= 36.37510
EXERCISE
Express D2.416 in decimal.
Let’s Do This!
(X) DECIMAL TO HEXADECIMAL CONVERSION
Technique
Divide by 16
Keep track of the remainder
Example 1: Convert 123410 to hexadecimal
Solution:
1234 / 16 = 77 remainder 2 (Least Significant Bit)
77 / 16 = 4 remainder D
4 / 16 = 0 remainder 4 (Most Significant Bit)
Answer: 123410 = 4D216
14
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
A decimal fraction number can be converted to hexadecimal number by repeatedly
multiplying the fractional number by 16.
Example 2: Convert 85.4310 to hexadecimal
Solution:
85 / 16 = 5 remainder 5 (Least Significant Bit)
5 / 16 = 0 remainder 5 (Most Significant Bit)
Result : 8510 = 5516
0.43 x 16 = 6.88 carry 6
0.88 x 16 = 14.08 carry E
0.08 x 16 = 1.28 carry 1
Result: 0.4310 = 6E116
Answer : 85.4310 = 55.6E116
EXERCISE
Convert 74.2310 to hexadecimal.
Let’s Do This!
(XI) OCTAL TO HEXADECIMAL CONVERSION
Technique
o Use binary as an intermediary
15
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Example 1: Convert 10768 to hexadecimal
Solution:
10 76
001 000 111 110
0010 0011 1110
23E
Answer: 10768 = 23E16
EXERCISE
Convert 63.158 to hexadecimal.
Let’s Try!
(XII) HEXADECIMAL TO OCTAL CONVERSION
• Technique
o Use binary as an intermediary
Example 1: Convert 1F0C16 to octal
Solution:
1 F 0C
0001 1111 0000 1100
000 001 111 100 001 100
0 17414
Answer: 1F0C16 = 174148
16
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
EXERCISE
Convert 34.2D16 to octal.
Let Do This!
BINARY ARITHMETIC - ADDITION
The rules for binary addition are:
0+0 = 0 carry 1
0+1 =1
1+0 =1
1+1 =0
Example 1: Add the binary numbers 00111 and 10101 and show the equivalent decimal
addition.
Solution: 111 7
21
00111
+ 10101 28
11100
BINARY ARITHMETIC - SUBTRACTION
The rules for binary subtraction are:
0-0 = 0
0 - 1 = 1 with a borrow 1
1-0 =1
1-1 =0
17
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Example 1: Subtract the binary number 00111 from 10101 and show the equivalent
decimal subtraction.
111 21
Solution: 7
10101
- 00111
01110 14
SIGNED NUMBERS
In real life we have to represent signed numbers (like: -12, -45, 78).
The difference between signed and unsigned numbers is the sign.
There are two method used to representing signed numbers in binary format.
(i) sign-magnitude representation
(ii) the 2’s-complement representation
SIGN-MAGNITUDE REPRESENTATION
In this representation, the leftmost bit of a binary code represents the sign of the value:
» 0 for positive
» 1 for negative
the remaining bits represent the numeric value.
To compute negative values using Sign/Magnitude (sign-mag) representation, begin with
the binary representation of the positive value, then flip the leftmost zero bit.
For example, the positive number 58 is written using 8-bits as
00111010 (true form)
Sign Bit Magnitude Bits
Example 1: Find the sign-mag representation of -610
Solution:
Step1: Find binary representation using 8 bits
610 = 000001102
Step2: If the number is a negative number flip left most bit
10000110
So: -610 = 100001102 (in 8-bit sign/magnitude form)
18
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
1’S COMPLEMENT REPRESENTATION
The 1’s complement of a binary number is just the inverse of the digits. To form the 1’s
complement, change all 0’s to 1’s and all 1’s to 0’s.
For example, the 1’s complement of 11001010 is 00110101
In digital circuits, the 1’s complement is formed by using inverters:
1 1 00 10 1 0
00 1 10 1 01
2’S COMPLEMENT REPRESENTATION
The 2’s complement of a binary number is found by adding 1 to the LSB of the 1’s
complement.
Recall that the 1’s complement of 11001010 is 00110101.
To form the 2’s complement, add 1:
1 (1’s complement)
00110101
+1
00110110 (2’s complement)
Example 1: Find the two’s complement representation of –610
Solution:
Step1: Find binary representation in 8 bits
610 = 000001102
Step 2: Complement the entire positive number, and then add one
00000110 (true form)
1
11111001 (1’s complement)
+ 1 (add 1)
11111010
So: -610 = 111110102 (in 2's complement form)
19
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Alternative method for step 2
Scan binary representation from right to left, find first one bit, from low-order (right) end,
and complement the remaining pattern to the left.
00000110
11111010 (2’s complement)
2’S COMPLEMENT ARITHMETIC
The maximum range of 2’s complement number :
+127 to -128 for 8-bit systems
+32 767 to -32 768 for 16-bit systems
When adding numbers in the 2’s complement form, simply perform a regular binary
addition to get the result.
When subtracting numbers in the 2’s complement form, convert the number being
subtracted to a negative 2’s complement number and perform a regular binary addition
[for example, 5 – 3 = 5 + (-3) ]. The result will be a 2’s complement number and if the
result is negative, the sign bit will be 1.
Example 1: Add 19 + 27 using 8-bit 2’s complement arithmetic.
Solution: 1 11
19 = 0001 0011
+ 27 = 0001 1011
4610 = 0010 1110
• Example 2: Solve the arithmetic +2510 - 1310 by using 8-bit two’s complement method.
Solution :
+2510 + (- 1310)
+25 = 0001 1001
+13 = 0000 1101
-13 = 0000 1101
= 1111 0010 (1’s complement)
+1
1111 0011 (2’s complement)
20
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
+25 111 11
+ (-13)
= 0001 1001
+12 = 1111 0011
1 0000 1100
Ignore the final carry
BINARY CODED DECIMAL (BCD) 8421 TO BINARY NUMBER AND VICE
VERSA
Example 1: Convert 49610 to BCD
Solution: 4 96
0100 1001 0110
Answer: 49610 = 0100 1001 0110BCD
Example 2: Convert 0110 1000 0011BCD to decimal
Solution:
0110 1000 0011
683
Answer: 0110 1000 0011BCD = 68310
Example 3: Convert 0110 0010 1100BCD to decimal
Solution:
0111 0010 1100
72 *
* This conversion is impossible because 1100 is not a valid binary coded decimal.
It is not in the range 0 to 9.
21
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
THE ASCII CODE
Most industry has settled on an input/output (I/O) code called the American Standard
Code for Information Interchange (ASCII).
The ASCII code uses 7 bits to represent all the alphanumeric data used in computer I/O.
Seven bits will yield 128 different code combinations as listed in Table 2.
Table 3: ASCII Table
Example 1: List the ASCII codes for the message “Study Smart!”
22
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Solution:
“ - 0100010
S - 1010011
t - 1110100
u - 1110101
d - 1100100
y - 1111001
sp – 0100000
S - 1010011
m - 1101101
a - 1100001
r - 1110010
t - 1110100
! - 0100001
“ - 0100010
23
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
THE GRAY CODE
The Gray code is unweighted and is not an arithmetic code.
The Gray code exhibits only a single bit change from one code number to the next.
The Gray code applications, as shaft position encoders.
The gray code can have any number of bits.
Decimal Binary Gray code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
(I) BINARY-TO-GRAY CODE CONVERSION
The rules explain how to convert from binary number to a Gray code number:
1. The most significant bit (left most) in the Gray code is the same as the corresponding
MSB in the binary number.
2. Going from the left to right, add each adjacent pair of binary code bits to get the next
Gray code bit. Discard carries.
24
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Example
Convert the binary number 10110 to Gray code.
Step 1: The left-most Gray code is the same as the left-most binary code bit.
10110 Binary
1 Gray
Step 2: Add the left-most binary code bit to the adjacent one.
1 + 0110 Binary
11 Gray
Step 3: Add the next adjacent pair. Binary
10 + 110
11 1 Gray
Step 4: Add the next adjacent pair and discard the carry. Binary
101+10
111 0 Gray
Step 5: Add the last adjacent pair. Binary
Gray
1011+ 0
111 0 1
The answer is 11101 in Gray code.
25
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
(2) GRAY-TO-BINARY CODE CONVERSION
The rules explain how to convert from binary number to a Gray code number:
1. The most significant bit (left most) in the Binary code is the same as the corresponding
bit in the Gray code.
2. Add each Binary Code git generated to the Gray code bit in the next adjacent position.
Discard carries.
Example
Convert the Gray code 11011 to binary number.
Step 1: The left-most bits are the same. Gray
Binary
11011
1
Step 2: Add the last binary code bit just generated to the Gray code bit in the next position.
Discard the carry.
1+1 0 1 1 Gray
Binary
10
Step 3: Add the last binary code bit generated to the next Gray code bit.
1 1+0 1 1 Gray
Binary
10 0
26
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
Step 4: Add the last binary code bit generated to the next Gray code bit.
11011 Gray
Binary
1 0 0+1
Step 5: Add the last binary code bit generated to the next Gray code bit. Discard the carry.
1 1 0 1+1 Gray
Binary
100 10
27
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
28
EXERCISE
1. Convert the following binary numbers to decimal.
(a) 010010112 (c) 1011.012
(b) 001101112 (d) 01110.112
2. Convert the following decimal numbers to binary.
(a) 16610 (c) 41410
(b) 251.410 (d) 366.1210
3. Convert the following binary numbers to octal.
(a) 010111012 (c) 11101102
(b) 1101101.112 (d) 01101.0102
4. Convert the following octal numbers to binary.
(a) 778 (c) 7258
(b) 45.368 (d) 214.358
5. Convert the following octal numbers to decimal.
(a) 378 (c) 122.58
(b) 5128 (d) 613.218
6. Convert the following decimal numbers to octal.
(a) 8910 (c) 75.2410
(b) 10810 (d) 45.12510
7. Convert the following binary numbers to hexadecimal.
(a) 101110012 (c) 1100101.0012
(b) 00111012 (d) 001110.112
8. Convert the following hexadecimal numbers to binary.
(a) FA16 (c) 62.1A16
(b) D6.416 (d) E2316
9. Convert the following hexadecimal numbers to decimal.
(a) CD516 (c) 91.5516
(b) 866.116 (d) B15.7516
DEE20033-Number Systems and Codes [CLO1,PLO1,CLS1,DK3]
10. Convert the following decimal numbers to hexadecimal.
(a) 6810 (c) 177.7710
(b) 18710 (d) 5142.6510
11. Convert the following BCD numbers to decimal.
(a) 10011000BCD (c) 001001011000.00110001BCD
(b) 10000001BCD (d) 100100100011.01110100BCD
12. Change 461.758 to BCD code.
13. By using ASCII code, interpret the sentences below:
Good Luck!
14. Fill up the spaces with the suitable answers.
DECIMAL BINARY OCTAL HEXADECIMAL
46 1110101
510
AD1
15. Solve the arithmetic below by using 8-bit two’s complement method. Then change the
answer to BCD 8421 code.
(i) + 4710 + 1110
(ii) + 8510 - 5310
(iii) - 9010 - 7010
16. (i) Convert the binary number 11000110 to Gray code.
(ii) Convert the Gray code 10101111 to binary number.
29