0% found this document useful (0 votes)
15 views22 pages

Computer Fundamental

Uploaded by

fardeenbaha679
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views22 pages

Computer Fundamental

Uploaded by

fardeenbaha679
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Computer Science Faculty

Introduction to Computer Science -1

© All rights reserved to Kateb University


Course Objectives
• Different systems
• Why study Numbers types of number System?
• Converting numbers from one system to another
• Decimal Conversion

Computer Science Faculty_Kateb University 2


Different Types Of Number System
• There are basically four types of number systems:
1.Decimal number system
2.Binary number system
3.Octal number system
4.Hexadecimal number system

Computer Science Faculty_Kateb University 3


Decimal / Octal Number System
• Decimal number system has 10 symbols or digits (0,1,2,3,4,5,6,7,8,9).
• For example (50)10, (950)10 and etc.
• Octal number system are only 8 digits or symbols 0,1,2,3,4,5,6,7.
• For example (655)8, (521)8 and etc.

Computer Science Faculty_Kateb University 4


Binary / Hexadecimal Number System
• Binary number system contains 0 and 1 as a digit.
• For example (11101)2, (0001)2 and etc.
• Every computer stores numbers, letters, and other special
characters in binary form.
• Hexadecimal number system consist of 16 symbols or digits
that starts from 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
• Such as (FFF0)16, (55BB)16 and etc.

Computer Science Faculty_Kateb University 5


Converting Decimal Number Into Binary Number

Methods
• Divide decimal number by 2.
• Repeat this method until quotient is less than 2.
• Bottom to top sequence of remainders will be the required binary
number.
Ex (1): (164)10 to (?)2
Let x be the required binary number.
(164)10 = (x)2

Computer Science Faculty_Kateb University 6


Converting Decimal Number Into Binary Number
Divisor Dividend Reminder
2 164 0
2 82 0
2 41 1
2 20 0
2 10 0
2 5 1
2 2 0
2 1 1
0

Computer Science Faculty_Kateb University 7


Converting Decimal Number Into Octal Number
Methods:
• Divide decimal number by 8 (base of octal number).
• Repeat this method until quotient is less than 8.
• Bottom to top sequence of reminders will be the required octal
8 2473 1
number.
8 309 5
Ex (1): (2473)10 = (x)8 8 38 6

8 4 4
0
Computer Science Faculty_Kateb University 8
Converting Decimal Number Into Hexadecimal Number
• Divide decimal number by 16.
• Repeat this method until quotient is less than 16.
• Bottom to top sequence of reminders will be the required hexadecimal
number. 16 26295 7
16 1643 11
16 102 6
16 6 6
0

Computer Science Faculty_Kateb University 9


Converting a Number of Another Base to a Decimal
Number
Example
47068 = ?10
Common

47068 = 4 x 83 + 7 x 82 + 0 x 81 + 6 x 80
values correspondin
= 4 x 512 + 7 x 64 + 0 + 6 x 1 g digits by the
multiplied
= 2048 + 448 + 0 + 6 Sum of these
products
= 250210

Computer Science Faculty_Kateb University 10


Converting a Decimal Number to a Number of Another
Base
Division-Remainder Method
Step 1: Divide the decimal number to be converted by
the value of the new base

Step 2: Record the remainder from Step 1 as the


rightmost digit (least significant digit) of the
new base number

Step 3: Divide the quotient of the previous divide by the


new base

Step 4: Record the remainder from Step 3 as the next


digit (to the left) of the new base number

Repeat Steps 3 and 4, recording remainders from right to


left, until the quotient becomes zero in Step 3

Note that the last remainder thus obtained will be the most
significant digit (MSD) of the new base number

Computer Science Faculty_Kateb University


Converting a Number of Some Base to a Number of Another Base
Method

Step 1: Convert the


original number to a
decimal number (base 10)
Step 2: Convert the decimal number so obtained to
the new base number

Computer Science Faculty_Kateb University 12


Converting a Number of Some Base to a Number of Another Base
Step 2: Convert 20910 to base 4
4 209 Remainder
s
Example 52
13 1
5456 = ?4 0
3
1
0
Solution: 3
Hence, 20910 = 31014
Step 1: Convert from base 6 to base 10
So, 5456 = 20910 = 31014
5456 = 5 x 62 + 4 x 61 + 5 x 60
= 5 x 36 + 4 x 6 + 5 x 1 Thus, 5456 = 31014
= 180 + 24 + 5
= 20910

Computer Science Faculty_Kateb University 13


Exercises

1. Convert 343 from decimal to binary


2. Convert 440 from decimal to octal
3. Convert 670 form decimal to hexadecimal
4. Convert 334 form octal to decimal
5. Convert 10110 from binary to decimal
6. Convert 232 from the base of 6 to base of 4.

Computer Science Faculty_Kateb University


Shortcut Method for Converting a Binary Number to its Equivalent Octal Number
Method
Step 1: Divide the digits into groups of three
starting from the right

Step 2: Convert each group of three binary digits to


one octal digit using the method of binary to
decimal conversion
Example
11010102 = ?8

Step 1: Divide the binary digits into groups of 3 starting


from right

001 101 010

Step 2: Convert each group into one octal

digit 0012 = 0 x 22 + 0 x 21 + 1 x 20

=1
1012 = 1 x 22 + 0 x 21 + 1 x 20 = 5
0102 = 0 x 22 + 1 x 21 + 0 x 20 = 2

Hence, 11010102 = 1528

Computer Science Faculty_Kateb University


Shortcut Method for Converting an Octal Number to Its Equivalent Binary Number
Method
Step Convert each octal digit to a 3 digit binary
number (the octal digits may be treated as
1: decimal for this conversion)

Step 2: Combine all the binary groups


(of 3 resulting
digits each) singl binary
number into a e

Example
5628 = ?2

Step 1: Convert each octal digit to 3 binary


digits 58 = 1012, 68 = 1102,
28 = 0102

Step 2: 562 = 101


Combine
8 110groups
the binary 010
5 6 2

Hence, 5628 = 1011100102

Computer Science Faculty_Kateb University


Shortcut Method for Converting a Binary Number to its Equivalent Hexadecimal Number
Method

Step 1: Divide the binary digits into groups of four


starting from the right

Step 2: Combine each group of four binary digits to


one hexadecimal digit

Example

1111012 = ?16

Step 1: Divide the binary digits into groups of four


starting from the right

0011 1101

Step 2: Convert each group into a hexadecimal digit


00112 = 0 x 23 + 0 x 22 + 1 x 21 + 1 x 20 = 310 =
316
11012 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 1310
= D16

Hence, 1111012 = 3D16


Computer Science Faculty_Kateb University
Shortcut Method for Converting a Hexadecimal Number to its Equivalent Binary Number
Method

Step 1: Convert the decimal equivalent of each


hexadecimal digit to a 4 digit binary
number

Step 2: Combine all the resulting binary groups


(of 4 digits each) in a single binary number

Example

2AB16 = ?2
Step 2: Combine the binary groups
Step 1: Convert each hexadecimal digit
to a 4 digit binary number 2AB16 = 0010 1010 1011

2 A B
= 00102
216 = 210
A16 = 1010 = 10102
Hence, 2AB16 = 0010101010112
B16 = 1110 = 10112

Computer Science Faculty_Kateb University


Formation of Fractional Numbers in Binary Number System
(Example)
Binary Point

Position 4 3 2 1 0 -2 -3 -4
. -1

Position Value 24 23 22 21 20 2-1 2-2 2-3 2-4

Quantity 16 8 4 2 1 1/ 1/ 1/ 1/
2 4 8 16
Represente
d

Example

110.1012 = 1 x 22 + 1 x 21 + 0 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3


= 4 + 2 + 0 + 0.5 + 0 + 0.125
= 6.62510
Formation of Fractional Numbers in Octal Number System
(Example)
Octal Point

Position 3 2 1 0 . -1 -2 -3

Position Value 83 82 81 80 8-1 8-2 8-3

Quantity 512 64 8 1 1/ 1/ 1/
8 64 512
Represente
d

Example

127.548 = 1 x 82 + 2 x 81 + 7 x 80 + 5 x 8-1 + 4 x
8-2
= 64 + 16 + 7 + 5/8 + 4/64
= 87 + 0.625 + 0.0625
= 87.687510

Computer Science Faculty_Kateb University


Conclusion
• Different types of number systems
• Why study Numbers System?
• Converting numbers from on7e system to another
• Decimal Conversion

Computer Science Faculty_Kateb University 21


Computer Science Faculty_Kateb University 22

You might also like