Sie sind auf Seite 1von 41

INTRODUCTION TO COMPUTING AND

PROGRAMMING
Slide set 2
15 EL-Sec I & II
Engr. Maria Shaikh
maria.sheikh@faculty.muet.edu.pk

Number System Overview


Number System is:
The way of representing numbers.
Way of counting.

Some common number systems:


Decimal Number System
Binary Number System
Octal Number System
Hexadecimal Number System
Engr. Maria Shaikh

Decimal Number System


Deci = 10
Base / Radix = 10
Digits = 0 1 2 3 4 5 6 7 8 9

0123456789
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29 30

Engr. Maria Shaikh

Binary Number System


Bi = 2
Base / Radix = 2
Digits = 0 & 1

01
10 11
100 101 110 111
1000 1001 1010 1011 1100 1101 1110 1111

Engr. Maria Shaikh

Octal Number System


Octate = 8
Base / Radix = 8
Digits = 0 1 2 3 4 5 6 7

01234567
10 11 12 13 14 15 16 17
20 21 22 23 24 25 26 27
30 31 32 33 34 35 36 37

Engr. Maria Shaikh

Hexadecimal Number System


Hexa = 6 & Deci = 10
Base / Radix = 16
Digits = 0 1 2 3 4 5 6 7 8 9 A B C D E F

0123456789ABCDEF
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

Engr. Maria Shaikh

Conversion from Decimal to


Binary Number System

Conversion from Decimal to Binary Number System


Example 01 :

Method 01:

= (? )
2

78

39 0

19 1

= ()
Engr. Maria Shaikh

Conversion from Decimal to Binary Number System


Example 01 :

= (? )
78
-64

Method 02:

64 32 16

14
-8
6
-4
2
-2
0

= ()
Engr. Maria Shaikh

Conversion from Decimal to Binary Number System


Example 02 :

Method 01:

= (? )
2

152

76

38

19

= ()
Engr. Maria Shaikh

Conversion from Decimal to Binary Number System


Example 02 :

= (? )

Method 02:

152
-128
128

64

32

16

24
-16
8
-8
0

= ()
Engr. Maria Shaikh

Conversion from Binary to


Decimal Number System

Conversion from Binary to Decimal Number System


Example 03 :

= (? )

Method 01:

+ + + + + +
+ + + + + + =

= ()
Engr. Maria Shaikh

Conversion from Binary to Decimal Number System


Example 03 : = (? )

Method 02:

64

32

16

64
8
4
2
78

= ()
Engr. Maria Shaikh

Conversion from Binary to Decimal Number System


Example 04 : = (? )

Method 01:
+ + + + + + +

+ + + + + + +

= ()
Engr. Maria Shaikh

Conversion from Binary to Decimal Number System


Example 04 : = (? )

Method 02:

128 64

32

16

= ()
Engr. Maria Shaikh

128
16
8
152

Conversion from Decimal to Octal


Number System

Conversion from Decimal to Octal Number System


Example 05 :

= (? )

789

98

12

= ()
Engr. Maria Shaikh

Conversion from Decimal to Octal Number System


Example 06 :

= (? )

1086

135

16

= ()
Engr. Maria Shaikh

Conversion from Octal to Decimal


Number System

Conversion from Octal to Decimal Number System


Example 07 : = (? )

+ + +

+ + + = 789

= ()
Engr. Maria Shaikh

Conversion from Octal to Decimal Number System


Example 08 : = (? )

+ + +

+ + + =

= ()

Engr. Maria Shaikh

Conversion from Decimal to


Hexadecimal Number System

Conversion from Decimal to Hexadecimal Number System


Example 09 :

= (? )

16

756

16

47

= ()
Engr. Maria Shaikh

Conversion from Decimal to Hexadecimal Number


System
Example 10 :

= (? )

16

11278

16

704

16

44

= ()
Engr. Maria Shaikh

Conversion from Hexadecimal to


Decimal Number System

Conversion from Hexadecimal to Decimal Number System


Example 11 : = (? )

+ +

+ + = 756

= ()
Engr. Maria Shaikh

Conversion from Hexadecimal to Decimal Number System


Example 12 : = (? )

+ + +

+ + + = 11278

= ()
Engr. Maria Shaikh

Conversion from Octal to


Binary Number System

Conversion from Octal to Binary Number System


Example 13 : = (? )

110

101

100

011

= ()
Engr. Maria Shaikh

000

001

010

011

100

101

110

111

Conversion from Octal to Binary Number System


Example 14 : = (? )

100 100 011 010 001 111

= ()
Engr. Maria Shaikh

000

001

010

011

100

101

110

111

Conversion from Binary to


Octal Number System

Conversion from Binary to Octal Number System


Example 15 : = (? )

110

110

111

010

111

001

= ()

Engr. Maria Shaikh

000

001

010

011

100

101

110

111

Conversion from Binary to Octal Number System


Example 16 : = (? )

001

110

100

011

010

101

= ()

Engr. Maria Shaikh

000

001

010

011

100

101

110

111

Conversion from Hexadecimal


to Binary Number System

Conversion from Hexadecimal to Binary Number


System
Example 17 : = (? )

0001

1010

1111

0010

= ()
Engr. Maria Shaikh

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Conversion from Hexadecimal to Binary Number


System
Example 18 : = (? )

0111

1001

1111

1111

1100

= ()
Engr. Maria Shaikh

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Conversion from Binary to


Hexadecimal Number System

Conversion from Binary to Hexadecimal Number


System
Example 19 : = (? )

0111

1001

1111

1111

1100

= ()

Engr. Maria Shaikh

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Conversion from Binary to Hexadecimal Number


System
Example 20 : = (? )

0001

1010

1111

0010

= ()

Engr. Maria Shaikh

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

END OF SLIDE SET 2


3/1/2015

Engr. Maria Shaikh

41

Das könnte Ihnen auch gefallen