You are on page 1of 24

Introduction to Number Systems

Demo CSE

Introduction to Number System

By : RK Khatri

Outlines
Introduction Common number systems. Counting Conversions Binary to Other number systems Others to Binary number system Decimal to Other number systems Others to Decimal number system Octal to Hexadecimal number system Hexadecimal to Octal number system

Demo CSE

Introduction to Number System

By : RK Khatri

INTRODUCION
We are familiar with the decimal number system in which digits are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. We use these numbers in and as phone number, age, score, weight, etc. The computer uses binary digits for its operation. Binary means 2. In the binary system, there are only two digits 0 and 1. How Computer works? The programmer or user feeds instruction and data in alphabets and decimal digits through the keyboard. These are converted to binary bits. Final result is again converted back to monitor in human readable form. Other number systems are Octal n Hexadecimals. Octal means 8 and hexadecimals means 16. Octal n hexadecimals are used in Computers internal processes.

Demo CSE

Introduction to Number System

By : RK Khatri

Common Number Systems


System Decimal Binary Octal Base 10 2 8 Symbols 0, 1, 9 0, 1 0, 1, 7 Used by humans? Yes No No Used in computers? No Yes No (In place of Hex)

Hexadecimal

16

0, 1, 9, A, B, F

No

No (Coding, color coding, registry)


By : RK Khatri

Demo CSE

Introduction to Number System

Quantities/Counting (1 of 3)
Decimal 0 1 2 3 4 5 6 7
Demo CSE

HexaBinary Octal decimal 0 0 0 1 1 1 10 2 2 11 100 101 110 111 3 4 5 6 7 3 4 5 6 7


p. 33 By : RK Khatri

Introduction to Number System

Quantities/Counting (2 of 3)
Decimal 8 9 10 11 12 13 14 15
Demo CSE

HexaBinary Octal decimal 1000 10 8 1001 11 9 1010 12 A 1011 1100 1101 1110 1111 13 14 15 16 17 B C D E F
By : RK Khatri

Introduction to Number System

Quantities/Counting (3 of 3)
Decimal 16 17 18 19 20 21 22 23
Demo CSE

HexaBinary Octal decimal 10000 20 10 10001 21 11 10010 22 12 10011 10100 10101 10110 10111 23 24 25 26 27 13 14 15 16 17 Etc.
By : RK Khatri

Introduction to Number System

Quantities/Counting (3 of 3)
Decimal Binary HexaOctal decimal

24 25 26 27 28 29 30 31 32
Demo CSE

10000 10001 10010 10011 10100 10101 10110 10111 11000

30 31 32 33 34 35 36 37 40

18 19 1A 1B 1C 1D 1E 1F 20

Etc.
By : RK Khatri

Introduction to Number System

Conversion Among Bases


The possibilities:
Decimal Octal

Binary

Hexadecimal

Demo CSE

Introduction to Number System

By : RK Khatri

Quick Example

2510 = 110012 = 318 = 1916


Base

Demo CSE

Introduction to Number System

By : RK Khatri

Binary to Others
110112 = ?10 = Sum of (bit x 2 weight ) weight = position of the bit from right. 1x24 + 1x23 + 0x22 + 1x21 + 1x20 = 27 110112 = ?8 = Make pairs of 3 bits. 011 011 = 33 110112 = ?16 = Make pairs of 4 bits. 0001 1011 = 1 B
Demo CSE

Introduction to Number System

By : RK Khatri

Others to Binary
2710 = ?2 = Divide by 2 read remainders in reverse !! 2 | 27 2 |13 | 1 2 |6 | 1 2 |3 | 0 2 |1 | 1 |1 = 11011 338 = ?2 = Convert in pairs of 3 bits. 011 011 1B16 = ?2 = Convert in pairs of 4 bits. 0001 1011

Demo CSE

Introduction to Number System

By : RK Khatri

Decimal to Others
2710 = ?2 = Divide by 2 read remainders in reverse !! 2 | 27 2 |13 | 1 2 |6 | 1 2 |3 | 0 2 |1 | 1 |1 = 11011

27710 = ?8 = Divide by 8 read remainders in reverse !! 8 | 277 8 |34 | 5 8 |4 | 2 | |4

= 425

Demo CSE

Introduction to Number System

By : RK Khatri

Decimal to Others
27710 = ?16 = Divide by 16 read remainders in reverse !! 16 |277 16 |17 | 5 16 |1 | 1 | |1

= 115

Demo CSE

Introduction to Number System

By : RK Khatri

Others to Decimal
110112 = ?10 = Sum of (bit x 2 weight ) weight = position of the bit from right. 1x24 + 1x23 + 0x22 + 1x21 + 1x20 = 27 1238 = ?10 = Sum of (bit x 8 weight ) weight = position of the bit from right. 1x82 + 2x81 + 3x80 = 83 3B16 = ?10 = Sum of (bit x 16 weight ) weight = position of the bit from right. 3x161 + 11x160 = 59
Demo CSE

Introduction to Number System

By : RK Khatri

Octal to Hexadecimal
Use binary as an intermediary
Octal > Binary > Hexadecimal
10768 = ?16 1 0 7 6

001 2

000 3

111

110 E 10768 = 23E16

Demo CSE

Introduction to Number System

By : RK Khatri

Hexadecimal to Octal
Use binary as an intermediary
Hexadecimal > Binary > Octal
23E16 = ?8 2 3 E

0010 1 0

0011 7

1110 6 23E16 = 10768

Demo CSE

Introduction to Number System

By : RK Khatri

Exercise Convert ...


Decimal 33 Binary 1110101 Octal

Hexadecimal

703
1AF
Dont use a calculator!
Skip answer
Demo CSE

Answer
By : RK Khatri

Introduction to Number System

Exercise Convert
Answer

Decimal 33 117

Binary 100001 1110101

Octal 41 165

Hexadecimal
21 75

451
431

111000011
110101111

703
657

1C3
1AF

Demo CSE

Introduction to Number System

By : RK Khatri

Fractions
Binary to decimal
10.1011 => 1 1 0 1 0 1 x x x x x x 2-4 2-3 2-2 2-1 20 21 = = = = = = 0.0625 0.125 0.0 0.5 0.0 2.0 2.6875

pp. 46-50 Demo CSE

Introduction to Number System

By : RK Khatri

Fractions
Decimal to binary
3.14579
.14579 x 2 0.29158 x 2 0.58316 x 2 1.16632 x 2 0.33264 x 2 0.66528 x 2 1.33056 etc. p. 50 Demo CSE

11.001001...
Introduction to Number System

By : RK Khatri

Exercise Convert ...


Hexadecimal

Decimal 29.8

Binary
101.1101

Octal

3.07 C.82
Dont use a calculator!
Skip answer
Demo CSE

Answer
By : RK Khatri

Introduction to Number System

Exercise Convert
Answer

Decimal 29.8
5.8125 3.109375 12.5078125

Binary Octal 11101.110011 35.63


101.1101 11.000111 1100.10000010 5.64 3.07 14.404

Hexadecimal 1D.CC 5.D 3.1C C.82

Demo CSE

Introduction to Number System

By : RK Khatri

Thank you

Demo CSE

Introduction to Number System

By : RK Khatri

You might also like