Human Language Conversion
Human Language Conversion
Human Language Conversion
Learning Objectives:
By the end of this chapter, the students will be able to;
• Know the concepts of computer language.
• Understand the number system representation.
Do you know that your computer has only two digits or answers to your questions? These are 0 and
1 or yes and no.
A digital system can understand positional number system only where there are a few
symbols called digits and these symbols represent different values depending on the
position they occupy in the number.
A value of each digit in a number can be determined using
• The digit
• The position of the digit in the number
• The base of the number system (where base is defined as the total number of digits
available in the number system).
As a computer programmer or an IT professional, you should understand the
following number systems which are frequently used in computers.
The number system includes decimal numbers, binary numbers, octal and hexadecimal
numbers.
S.N. Number System & Description
1
1. Binary Numbers – are 1 and 0 with a base of 2. The 0 and 1 are called bit, short for binary
digit. If we have 8 bits, we call it a byte. Byte is the basic word of the computer language.
Each character on the keyboard has a decimal number and this decimal number is changed
to a binary code.
Bit - 0 1
Byte - 0 0101100
Characteristics
• Uses two digits, 0 and 1.
• Also called base 2 number system
• Each position in a binary number represents a 0 power of the base (2). Example: 2 0
• Last position in a binary number represents an x power of the base (2). Example: 2 x where
x represents the last position - 1.
Binary Counting
Decimal Number Binary Number
8 4 2 1
Numbers
Code
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
This table shows the corresponding equivalent of the decimal number 1 to 10 into a binary
digit and we use the 8, 4, 2, 1 code. With the code, we will be able to determine the equivalent
numbers of decimal numbers to binary digits.
Just remember that the code is always doubled when your number increases.
How?
1 becomes 2,
2 becomes 4,
4 becomes 8, then
8 becomes 16,
then double 16 we have 32 and so on.
2
Later on, we will use this code for the short cut method of converting a decimal number to a
binary number. Let’s proceed first to the next number system.
3. Octal
Characteristics
• Uses eight digits, 0,1,2,3,4,5,6,7.
• Also called base 8 number system
• Each position in an octal number represents a 0 power of the base (8). Example: 8 0
• Last position in an octal number represents an x power of the base (8). Example: 8 x where
x represents the last position - 1.
4. Hexadecimal Number – are numbers from 0 to 9 and the letters A to F with a base of 16
Characteristics
• Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
• Letters represents numbers starting from 10. A = 10, B = 11, C = 12, D = 13, E = 14, F =
15.
• Also called base 16 number system.
• Each position in a hexadecimal number represents a 0 power of the base (16). Example
160.
• Last position in a hexadecimal number represents an x power of the base (16). Example
16x where x represents the last position - 1.
A is equivalent to 10
B is equivalent to 11
C is equivalent to 12
D is equivalent to 13
E is equivalent to 14
F is equivalent to 15
Example:
2316 or 23 base 16
67816 or 678 base 16
6AB716 or 6AB7 base 16
FEBD16 or FEBD base 16
3
Hexadecimal Numbers
Binary Numbers
Decimal Number Hexadecimal Numbers
(Coded)
0 0 0 0 0 0
1 1 0 0 0 1
2 2 0 0 1 0
3 3 0 0 1 1
4 4 0 1 0 0
5 5 0 1 0 1
6 6 0 1 1 0
7 7 0 1 1 1
8 8 1 0 0 0
9 9 1 0 0 1
10 A 1 0 1 0
11 B 1 0 1 1
12 C 1 1 0 0
13 D 1 1 0 1
14 E 1 1 1 0
15 F 1 1 1 1
The table shows the equivalent of decimal numbers to hexadecimal numbers and their
corresponding binary digits.
4
Other Base System to Decimal System
Steps
• Step 1 − Determine the column (positional) value of each digit (this depends on the
position of the digit and the base of the number system).
• Step 2 − Multiply the obtained column values (in Step 1) by the digits in the corresponding
columns.
• Step 3 − Sum the products calculated in Step 2. The total is the equivalent value in
decimal.
Conversion Exercises:
Binary to decimal:
10002 = ________________10
0 x 20 = 0
0 x 21 = 0 That’s the same answer we have in our table
0 x 22 = 0
1 x 23 = 8
810
111012 = _____________10
1 x 20 = 1
0 x 21 = 0
1 x 22 = 4
1 x 23 = 8
1 x 24 = 16
2910
10000012 = _____________10
1 x 20 = 1
0 x 21 = 0 Remember that any number multiplied to zero is
0 x 22 = 0 always zero.
0 x 23 = 0
0 x 24 = 0
0 x 25 = 0
1 x 26 = 64
6510
5
10101012 = _____________10
1 x 20 = 1
0 x 21 = 0
1 x 22 = 4
0 x 23 = 0
1 x 24 = 16
0 x 25 = 0
1 x 26 = 64
8510
In a decimal to binary conversion, you should continuously divide the number to 2 until you reach a
number that is not divisible by 2.
• 810 = _______2
Step Operation Result Remainder
Step 1 8/2 4 0
Step 2 4/2 2 0
Step 3 2/2 1 0
Step 4 1/2 0 1
The answer of 810 10002
• 2910 = _______________2
Step Operation Result Remainder
Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7/2 3 1
Step 4 3/2 1 1
Step 5 1/2 0 1
6
• 6510 = _______2
Step Operation Result Remainder
Step 1 65 / 2 32 1
Step 2 32 / 2 16 0
Step 3 16 / 2 8 0
Step 4 8/2 4 0
Step 5 4/2 2 0
Step 6 2/2 1 0
Step 7 1/2 0 1
The answer of 6510 10000012
• 8510 = _______2
Step 1 85 / 2 42 1
Step 2 42 / 2 21 0
Step 3 21 / 2 10 1
Step 4 10 / 2 5 0
Step 5 5/2 2 1
Step 6 2/2 1 0
Step 7 1/2 0 1
The answer of 6510 10101012
7
Shortcut method - Binary to Octal
Steps
• Step 1 − Divide the binary digits into groups of three (starting from the right).
• Step 2 − Convert each group of three binary digits to one octal digit.
Group of 3 since 8 (Octal) is 23 in Binary equivalent
Example
Binary Number − 101012
Calculating Octal Equivalent −
Step 2 101012 28 58
Steps
• Step 1 − Convert each octal digit to a 3 digit binary number (the octal digits may be treated
as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary
number.
Example
Octal Number − 258
Calculating Binary Equivalent −
8
Shortcut method - Binary to Hexadecimal
Steps
• Step 1 − Divide the binary digits into groups of four (starting from the right).
• Step 2 − Convert each group of four binary digits to one hexadecimal symbol.
Group of 4 since 16 (Hexa) is 24 in Binary equivalent
Example
Binary Number − 101012
Calculating hexadecimal Equivalent −
Steps
• Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the hexadecimal digits
may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary
number.
Example
Hexadecimal Number − 1516
Calculating Binary Equivalent −
9
Other Base System to Non-Decimal System
Steps
• Step 1 − Convert the original number to a decimal number (base 10).
• Step 2 − Convert the decimal number so obtained to the new base number.
Example
Octal Number − 258
Calculating Binary Equivalent −
Step 1 − Convert to Decimal
Step Octal Number Decimal Number
Step 1 21 / 2 10 1
Step 2 10 / 2 5 0
Step 3 5/2 2 1
Step 4 2/2 1 0
Step 5 1/2 0 1
10
Hexadecimal to Decimal Conversion
Hexadecimal Number: 19FDE16
Calculating Decimal Equivalent −
Step 2 19FDE16 ((1 × 164) + (9 × 163) + (15 × 162) + (13 × 161) + (14 ×
160))10
Number system
https://www.youtube.com/watch?v=L2zsmYaI5ww
https://www.tutorialspoint.com/computer_logical_organization/digital_number_system.htm
Tutorial Video:
Binary to Decimal
https://www.youtube.com/watch?v=VLflTjd3lWA
https://www.youtube.com/watch?v=tfKe8PPI2zs
Decimal to Binary
https://www.youtube.com/watch?v=OezK_zTyvAQ
https://www.youtube.com/watch?v=rsxT4FfRBaM
https://www.youtube.com/watch?v=rsxT4FfRBaM&t=66s
Binary to Hexadecimal
https://www.youtube.com/watch?v=tSLKOKGQq0Y
Decimal to Hexadecimal
https://www.youtube.com/watch?v=QJW6qnfhC70
11
Task:
Convert the following: Show your solution and reflect the base.
12