wooseokkim wkim3@albanywooseok/201fall/slide/lab3.pdf•decimal numeral system (base-10) •binary...

14
Lab 3 Wooseok Kim [email protected] www.cs.albany.edu/~wooseok/201

Upload: others

Post on 24-Oct-2019

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Lab 3Wooseok Kim

[email protected]

www.cs.albany.edu/~wooseok/201

Page 2: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Number Systems

• Decimal Numeral System (Base-10)• Binary Numeral System (Base-2) • Octal Numeral System (Base-8)• Hexadecimal Numeral System (Base-16)

Page 3: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Number Systems

• Decimal Numeral System • Binary Numeral System – Uses only 0 and 1 digits• Octal Numeral System – Uses from 0 ~ 7 digits• Hexadecimal Numeral System – Uses from 0 ~ 9 and A ~ F

Page 4: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Decimal Binary Octal Hexadecimal

0 0000 0 0

1 0001 1 1

2 0010 2 2

3 0011 3 3

4 0100 4 4

5 0101 5 5

6 0110 6 6

7 0111 7 7

8 1000 10 8

9 1001 11 9

10 1010 12 A

11 1011 13 B

12 1100 14 C

13 1101 15 D

14 1110 16 E

15 1111 17 F

Page 5: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Convert Decimal to Binary

532

262

132

62

32

12

remainder = 1 = a0

remainder = 0 = a1

remainder = 1 = a2

remainder = 0 = a3

remainder = 1 = a4

0 remainder = 1 = a5

Read

Page 6: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Convert Binary to Decimal

111001

111001 1 2 1 2 1 2 0 2 0 2 1 232 16 8 0 0 1 = 57

Binary Number

1 1 1 0 0 1

Power of 2 2 2 2 2 2 2

Page 7: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Convert Decimal to Hexadecimal

3536116

222616

13916

816

0

remainder = 15 = F = a0

remainder = 2 = a1

remainder = 11 = B = a2

remainder = 8 = a3

Read

Page 8: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Convert Hexadecimal to Decimal

• 3

• 3 3 16 16 48 11 1 59

HEX 3 B

Power of 16 16 16

Page 9: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Convert Binary to Hexadecimal

• Convert each hexadecimal digit into 4 bits binary• : Make bits’ groups

1654

2 5.41100 0101 1101 0100010111.1001101 CDCD

Page 10: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Hexadecimal to BinaryHEX BIN

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

A 1010

B 1011

C 1100

D 1101

E 1110

F 1111

=

Page 11: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

SummaryPositional notation

Decimal

Binary

Radix

Octal

Hexadecimal

33

22

11

00

11

22

33

44

32101234

).(

RaRaRa

RaRaRaRaRa

aaaaaaaaN R

10

10128

375.1038373264838784813.147

2101210 10810710310510978.953

10

2101232

75.114311

41

211208

21212121202111.1011

10012

16 260715322560161516216102 FA

Page 12: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

Summary

35361R

XXXXR

XXXR

XR

0

remainder = a0

remainder = a1

remainder = a2

remainder = a3

Read

Page 13: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

ASCII Table

• American Standard Code for Information Interchange

• Character Encoding Standard

Page 14: WooseokKim wkim3@albanywooseok/201Fall/slide/Lab3.pdf•Decimal Numeral System (Base-10) •Binary Numeral System (Base-2) •Octal Numeral System (Base-8) •Hexadecimal Numeral System

ASCII Table