NUMBER SYSTEM
Binary
Octal
Decimal
Hexadecimal number system
conversion between number
systems.
BINARY NUMBER SYSTEM
Consists of 2 values. 0 and 1 Base is 2
General representaion :10012
DECIMAL NUMBER SYSTEM
1> consist of 10 digits. ( 0 to 9 )
2> base is 10. eg: 23910
OCTAL NUMBER SYSTEM
1> consist of 8 digits. ( 0 to 7 )
2> base is 10. eg: 2378
HEXADECIMAL NUMBER SYSTEM
1> consist of 16 digits. ( 0 to 9 AND A to F )
2> base is 16. eg: 2B916
CONVERSION FROM __ANY TYPE_ TO DECIMAL
POSITIONAL VALUE PROCESS
-Write the positional value or weights of the
digits
-Digit before decimal point is to be weighted 0
-Digit after decimal point weights -1
-E.g : (1010.0101)
BINARY TO DECIMAL
2
23 22 21 20 2-1 2-2 2-3 2-4
1 0 1 0 0 1 0 1
Calculate as:
1 x 23 + 0 x 22 +1 x 21 + 0 x 20 +0 x 2-1 + 1 x 2-2
+ 0 x 2-3 + 1 x 2-4 =8 + 2 + 0.25 +0.0625
= 10.312510
OCTAL TO DECIMAL
E.g : (3721.2406)8
83 82 81 80 8-1 8-2 8-3 8-4
3 7 2 1 2 4 0 6
Calculate as:
3 x 83 + 7 x 82 + 2 x 81+1 x 80 + 2 x 8-1 + 4 x 8-2
+0 x 8-3 + 6 x 8-4 =
1536 +448 + 16 + 1 + 0.25+ 0.625+ 0+0.001464
= 2001.31396410
HEXADECIMAL TO DECIMAL
E.g : (56.08)16 Calculate as:
5 x161+ 6 x160+ 0 x16-1+8 x16-2
1 0
16 16 16 16-1 -2
5 6 0 8 = 80 + 6 + 0 + 0.03125
= 86.0312510
CONVERSION FROM DECIMAL TO ANY TYPE
REPETED DIVISION METHOD
-Divide the decimal value (before .) with the required
base continuously till a digit less than the base is
encountered
-Store the remainder of each division separately.
-Write the remainders in reverse order
DECIMAL TO BINARY
38.2510 = (100110 . 01 )2 2 38 0
2 19 1
.25
x 2 2 9 1
0 0.50 2 4 0
x 2
1 2 2 0
1.00
1
DECIMALPOINT TO BINARY (after .)
• To convert the value after decimal point:
– Write the values discarding the value before the
decimal point
– Multiply it with 2 continuously till 0 is
encountered after the decimal point
– While multiplying keep the value before decimal
point aside.
– Finally write those values from top to bottom
DECIMAL TO OCTAL
266.37510 = ( 412 . 3 )8
.375
8 266 2 x 8
8 33 1 3 3.000
4
DECIMAL TO HEXADECIMAL
423.0312510 = ( 1A7 . 08 )16
.13125
16 423 7 x 16
0 0.5
16 26 10 A x 16
1 8 8.0
powers of 2 method
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 0 0 0 0 0 0 0 1
2 0 0 0 0 0 0 1 0
3 0 0 0 0 0 0 1 1
4 0 0 0 0 0 1 0 0
27 0 0 0 1 1 0 1 1
99 0 1 1 0 0 0 1 1
BINARY TO OCTAL
100111010.01012= ( 472 . 24 )8
1 0 0 1 1 1 0 1 0 . 0 1 0 1 0 0
4 7 2 2 4
BINARY TO HEXADECIMAL
1110101110.0101112= ( 3AE.5C )16
0 01 1 1 0 1 0 1 1 1 0 . 0 1 0 1 1 10 0
3 A E 5 C
OCTAL TO BINARY
5431.138= (101100011001 . 001011 )2
5 4 3 1 . 1 3
101 100 011 001 001 011
OCTAL TO HEXADECIMAL
5431.138= ( B19 . 2C )16
1 0 1 1 0 0 01 1 0 0 1.0 0 1 0 1 100
B 1 9 2 C
11 12
HEXADECIMAL TO BINARY
9F2. 5C16= ( 100111110010 . 01011100 )2
9 F 2 . 5 C
1001 1111 0010 0101 1100
HEXADECIMAL TO OCTAL
9F2. 5C16= ( 476 . 27 )8
100111110010 . 01011100
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
OCTAL SYSTEM ----HEXADECIMAL SYSTEM----
4 2 1 | 8 4 2 1 | 8 4 2 1
0 0 0 0 | 0 0 0 0 8 1 0 0 0
1 0 0 1 | 0 0 0 1 9 1 0 0 1
2 0 1 0 | 0 0 1 0 A 1 0 1 0
3 0 1 1 | 0 0 1 1 B 1 0 1 1
4 1 0 0 | 0 1 0 0 C 1 1 0 0
5 1 0 1 | 0 1 0 1 D 1 1 0 1
6 1 1 0 | 0 1 1 0 E 1 1 1 0
7 1 1 1 | 0 1 1 1 F 1 1 1 1
Encoding Schemes
ASCII
ISCII
UNICODE (UTF8,UTF32)
The mechanism of converting data into an equivalent
cipher using specific code is called encoding.
Cipher TEXT is the encoded text received by applying
encoding schemes/ techniques.
Encoding schemes are the techniques where each
letter, numeral and symbol is encoded or assigned a
unique code. Some of the well-known encoding
schemes are:
ASCII ISCII UNICODE
ASCII
Alphanumeric code
American Standard For Information Interchange
Consists of 7 bits i.e capable of coding 27 = 128
characters
Represents all standard keyboard characters as
well as control functions.
8 bit ASCII( extended version of 7 bit ASCII) can
represent 256 characters.
ISCII
Indian Standard For Information Interchange
Developed by C-DAC
Consists of 8 bits.i.e capable of coding 28 = 256
characters
Retains all ASCII characters and offers coding
for Indian scripts also.
UNICODE
• The common coding system that
acknowledges all characters, symbols,
emoji’s etc available in different encoding
systems globally
• It ensure’s that the same software/website
serves the purpose of recognizing different
languages irrespective of the platform.
• It defines 4 ways of character encoding:
UTF-8 UTF-16
UTF-24 UTF-32
UNICODE
UTF-8 (1 Octet) Representation:
It uses 8 bits to encode 128 characters.
0
Control Bit Value Bit
E.g: Represent U+0041 in UTF-8(1 Octet) form
0 1 0 0 0 0 0 1
Binary of (0041)16 is 1000001
Question: Represent U+0023 in UTF-8(1 Octet) form
UTF-16 (2 Octet) Representation:
It uses 16 bits (2 Octets) to encode
characters.
1 1 0 1 0
Control Bit Value Bit Control Bit Value Bit
E.g: Represent U+00AE in UTF-16(2 Octet) form
Binary of (00AE)16 is10101110
1 1 0 0 0 0 1 0 1 0 1 0 1 1 10
Question: Represent U+00B2in UTF-16(2 Octet) form
UTF-24 (3 Octet) Representation:
It uses 24 bits (3 Octets) to encode
characters.
1 1 1 0 1 0
Control Bit Value Bit Control Bit Value Bit
1 0
Control Bit Value Bit
E.g: Represent U+27D8 in UTF-24(3Octet) form
2 7 D 8 = (10011111011000)
1 1 1 0 0 0 1 0 1 0 0 1 1 1 1 1
1 0 0 1 1 0 0 0
UTF-32 (4 Octet) Representation:
It uses 32 bits (4 Octets) to encode
characters.
1 1 1 1 0 1 0
Control Bit Value Bit Control Bit Value Bit
1 0 1 0
Control Bit Value Bit Control Bit Value Bit
E.g: Represent U+10318 in UTF-32(4Octet)
form
11110000 10001000 10 000100010011000