L 4.2 Computer Number System Conversions
L 4.2 Computer Number System Conversions
in Computer
Dr Anita Choudhary
Assistant Professor
Department of Computer Science
[email protected] 05/11/202
5
1
Table of
Content
Number Systems
Common Number
Systems
Conversion Among
Bases
05/11/2025 2
Conversion among Bases
Divide by 8
Decimal Multiply each bit by t Octal
Di 8n al en
Multiply each bit
Mu v id
e qu iv
by ltip by t e i onin
3-bit equivalent
16 n ly e 16 i t
4-bit equivalent
-b ry nta its ting
Divide by 2
representation
representation
ac 3 a e b r
hb bin presoup , sta
it re Gr e e s t
r h
th rig
binary
on
binary
by 2n
Decimal Octal
Binary Hexadecimal
05/11/2025 4
Decimal to Octal
• Technique
• Divide by 8
• Keep track of the remainder
05/11/2025 5
Example
123410 = ?8
8 1234
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
05/11/2025 6
Decimal to Hexadecimal
Decimal Octal
Binary Hexadecimal
05/11/2025 7
Decimal to Hexadecimal
• Technique
• Divide by 16
• Keep track of the remainder
05/11/2025 8
Example
123410 = ?16
16 1234
16 77 2
16 4 13 = D
0 4
123410 = 4D216
05/11/2025 9
Binary to Octal
Decimal Octal
Binary Hexadecimal
05/11/2025 10
Binary to Octal
• Technique
• Group bits in threes, starting on right
• Convert to octal digits
05/11/2025 11
Example
10110101112 = ?8
1 3 2 7
10110101112 = 13278
05/11/2025 12
Binary to Hexadecimal
Decimal Octal
Binary Hexadecimal
05/11/2025 13
Binary to Hexadecimal
• Technique
• Group bits in fours, starting on right
• Convert to hexadecimal digits
05/11/2025 14
Example
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
05/11/2025 15
Octal to Hexadecimal
Decimal Octal
Binary Hexadecimal
05/11/2025 16
Octal to Hexadecimal
• Technique
• Use binary as an intermediary
05/11/2025 17
Example
10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
05/11/2025 18
Hexadecimal to Octal
Decimal Octal
Binary Hexadecimal
05/11/2025 19
Hexadecimal to Octal
• Technique
• Use binary as an intermediary
05/11/2025 20
Example
1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
05/11/2025 21
Example
Hexa-
Decimal Binary Octal decimal
33
1110101
703
1AF
05/11/2025 22
Common Powers (1 of 2)
• Base 10
Power Preface Symbol Value
10-12 pico p .000000000001
10-9 nano n .000000001
10-6 micro .000001
10-3 milli m .001
103 kilo k 1000
106 mega M 1000000
109 giga G 1000000000
1012 tera T 1000000000000
05/11/2025 23
Common Powers (2 of 2)
• Base 2
Power Preface Symbol Value
210 kilo k 1024
220 mega M 1048576
230 Giga G 1073741824
05/11/2025 25