Number System: Khaliq Ahmad
Number System: Khaliq Ahmad
Number System: Khaliq Ahmad
Compiled By:
Khaliq Ahmad
Chapter Goals
2 Number System 24
6
Number Representations
There are basically two ways of representing
the numerical value of quantities: analog and
digital.
Analog Representation
Natural Numbers
Zero and any number obtained by repeatedly adding
one to it.
Negative Numbers
A value less than 0, with a – sign
12 Number System
Numbers (Cont’d)
Integers
A natural number, a negative number, zero
Rational Numbers
An integer or the quotient of two integers
13 Number System 3
Exponents
20 = 1
21 = 2
22 = 2 x 2 =4
23 = 2 x 2 x 2 = 8
x5 + x10 = x15
1 / x2 = x -2
14 Number System
Bit & Byte
Computer uses the binary system. Any physical
system that can exist in two distinct states (e.g., 0-
1, on-off, hi-lo, yes-no, up-down, north-south, etc.)
has the potential of being used to represent
numbers or characters.
A binary digit is called a bit. There are two
possible states in a bit, usually expressed as 0
and 1.
A series of eight bits strung together makes a
byte, much as 12 makes a dozen. With 8 bits, or 8
binary digits, there exist 2^8=256 possible
K&M
Base: 10
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Representation
5234
Thousands Hundreds Tens Units
5 2 3 4
21 Number System
Decimal Numbering systems
Example: 523410
22 Number System
Positional Notation
As a formula:
25 Number System
Binary Numbering systems
Base: 2
Digits: 0, 1
binary number: 1101012
positional powers of 2: 25 24 23 22 21 20
decimal positional value: 32 16 8 4 2
1
binary number: 1 1 0 1 0 1
26 Number System
Converting Binary to Decimal
28 Number System
Binary to Decimal Conversion
Ex: 1010112
positional powers of 2: 25 24 23 22 21 20
decimal positional value:
binary number:
29 Number System
Decimal to Binary Conversion
The Division Method. Divide by 2 until you reach zero, and
then collect the remainders in reverse.
Ex 1: 5610 = 1110002
2 ) 56 Rem:
2 ) 28 0
2 ) 14 0
2) 7 0
2) 3 1
2) 1 1
0 1
30 Number System
Decimal to Binary Conversion
Ex 2: 3510 =
2) Rem:
2)
2)
2)
2)
2)
Answer: 3510 = 2
31 Number System
Decimal to Binary Conversion
32 Number System
Decimal to Binary Conversion
Ex 1: 5610
56 2 6 | 25 2 4 2 3 2 2 2 1 2 0
- 32 64 | 32 16 8 4 2 1
24 | 1 1 1 0 0 0
- 16
8
- 8
0
Answer: 5610 = 1110002
33 Number System
Decimal to Binary Conversion
Ex 2: 3810
38 2 6 | 25 2 4 2 3 2 2 2 1 2 0
|
|
Answer: 3810 = 2
34 Number System
Character Representation
ASCII Table
Rightmost Leftmost Three Bits
Four Bits 000 001 010 011 100 101 110 111
0000 NUL DLE Space 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EOT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y I y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
35 Number System
Character Representation
Ex: Find the binary ASCII and decimal ASCII values for the ‘&’
character.
Rightmost Leftmost Three Bits
Four Bits
0000
000
NUL
001
DLE
010
Space
011
0
100
@
101
P
110
`
111
p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EOT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y I y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
36 Number System
Character Representation
ASCII Table
37 Number System
Octal Numbering systems
Base: 8
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Octal number: 12468
powers of : 84 83 82 81 80
decimal value: 4096 512 64 8 1
Octal number: 1 2 4 6
38 Number System
Octal to Decimal Conversion
To convert to base 10, beginning with the
rightmost digit multiply each nth digit by 8(n-1),
and add all of the results together.
Ex: 12468
positional powers of 8: 8 3 8 2 81 8 0
decimal positional value: 512 64 8 1
Octal number: 1 2 4 6
512 + 128 + 32 + 6 = 67810
39 Number System
Octal to Decimal Conversion
Ex: 103528
positional powers of 8: 84 83 82 81 80
decimal positional value:
Octal number:
40 Number System
Decimal to Octal Conversion
The Division Method. Divide by 8 until you reach zero, and
then collect the remainders in reverse.
Ex 1: 433010 = 103528
8 ) 4330 Rem:
8 ) 541 2
8 ) 67 5
8) 8 3
8) 1 0
0 1
41 Number System
Decimal to Octal Conversion
Ex 2: 81010 =
8 ) 810 Rem:
8)
8)
8)
Answer: 81010 = 8
42 Number System
Hexadecimal Numbering systems
Base: 16
Digits: 0, 1, 2, 3, 4, 5, 6, 7,8,9,A,B,C,D,E,F
Hexadecimal number: 1F416
powers of : 164 163 162 161 160
decimal value: 65536 4096 256 16 1
Hexadecimal number: 1 F 4
43 Number System
Hexadecimal Numbering systems
44 Number System
Hexa to Decimal Conversion
To convert to base 10, beginning with the
rightmost digit multiply each nth digit by 16(n-1),
and add all of the results together.
Ex: 1F416
positional powers of 16: 163 162 161 160
decimal positional value: 4096 256 16 1
Hexadecimal number: 1 F 4
256 + 240 + 4 = 50010
45 Number System
Hexa to Decimal Conversion
Ex: 7E16
positional powers of 16: 163 162 161 160
decimal positional value:
Hexa number:
46 Number System
Converting Hexadecimal to
Decimal
Remember, base 16 is
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
47 Number System
Decimal to Hexa Conversion
48 Number System
Decimal to Hexa Conversion
Ex 2: 81010 =
16 ) 810 Rem:
16 )
16 )
Answer: 81010 = 16
49 Number System
Binary to Octal Conversion
50 Number System
Binary to Octal Conversion
Three-bit Group Decimal Digit Octal Digit
000 0 0
001 1 1
010 2 2
011 3 3
100 4 4
101 5 5
110 6 6
111 7 7
51 Number System
Octal to Binary Conversion
Ex :
Convert 7428 = 2
7 = 111
4 = 100
2 = 010
52 Number System
Binary to Octal Conversion
Ex :
Convert 101001102 = 8
110 = 6
100 = 4
010 = 2 ( pad empty digits with 0)
101001102 = 2468
53 Number System
Binary to Hexa Conversion
54 Number System
Binary to Hexa conversion
55 Number System
Hexa to Binary Conversion
Ex :
Convert 3D98 = 2
3 = 0011
D = 1101
9 = 1001
56 Number System
Binary to Hexa Conversion
Ex :
Convert 101001102 = 8
0110 = 6
1010 = A
101001102 = A616
57 Number System
Octal to Hexa Conversion
58 Number System
Hexa to Octal Conversion
Ex :
Convert E8A16 = 8
7 2 1 2
E8A16 = 72178
59 Number System
Octal to Hexa Conversion
Ex :
Convert 7528 = 16
1 E A
7528 = 1EA16
60 Number System
Hexa to Octal ( Example No 2 )
61 Number System
Hexa to Octal ( Example No 2 )
3 A Hex 3A
62 Number System
Octal to Hexa ( Example No 2 )
63 Number System
Octal to Hexa ( Example No 2 )
3 7 2 Octal 372
F A Convert to Hex
64 Number System
Arithmetic in Binary
65 Number System