CS110 4
CS110 4
To Computing
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights Reserved.
May not be
Jennifer T. scanned,
Campbell,copied or duplicated,
Discovering or posted
Computers: Digital to a publicly Data,
Technology, accessible website,17th
and Devices, in whole or ©
Edition. in 2023
part. Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 1
Introduction
• We use computer to process the data and get the desired output.
• The data input can be in the form of alphabets, digits, symbols, audio,
video, magnetic cards, finger prints, etc.
• Since digital computer can only understand 0 and 1, the data must be
represented in the computer in 0s and 1s.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 2
Introduction
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 3
Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 4
Number Systems
• The base of the number decides the valid digits that are used to
make a number.
• In a number, the position of digit starts from the right-hand side of
the number.
• The rightmost digit has position 0, the next digit on its left has
position 1, and so on.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 5
Number Systems
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 6
Number Systems
• The number is calculated as the sum of, face value * base position, of
each of the digits. For decimal number 52, the number is 5*101 + 2*100
= 50 + 2 = 52.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 7
Number Systems of interest
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 8
Decimal Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 9
Decimal Numbers
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 10
Octal Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 11
Octal Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 12
Hexadecimal Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 13
Hexadecimal Number System
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 14
Conversion from Decimal to Binary, Octal,
Hexadecimal
• A decimal number has two parts—integer part and fraction part.
• Eg. In the number 23.078, 23 is the integer part and 0.078 is the
fraction part.
• The method used for the conversion of the integer part of a decimal
number is different from the one used for the fraction part.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 15
Conversion from Decimal to Binary (Convert 25
from Base 10 to Base 2)
1. Make a table as
shown . Write the
number in centre
and to Base on the
left side.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 16
Converting 25 from base 10 to Base 2
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 17
Converting 25 from base 10 to base 2
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 18
Try
a) 53
b) 68
c) 29
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 19
Converting Decimal Fraction to other
bases
• A fractional number is a number less than 1.
• To convert a decimal fraction to—
• binary-multiply by 2,
• octal-multiply by 8, and,
• Hexadecimal-multiply by 16.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 20
Converting fractions (Steps)
• 1. Multiply the fractional number with the to Base, to get a resulting number.
• 2. The resulting number has two parts, non-fractional part and fractional part.
• 5. Write the digits in the non-fractional part starting from upwards to downwards.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 21
Convert 0.2345 from Base 10 to
Base 2.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 22
Convert 0.2345 from Base 10 to Base 2.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 23
Try
a) 0.865
b) 0.455
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 24
Converting Decimal Integer. Fraction to
other bases
• The steps for conversion of a decimal fraction to any other base are—
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 26
Conversion of Binary, Octal, Hexadecimal
to Decimal
• Numbers have two parts—integer part and fraction part.
• The method used for the conversion of integer part and fraction part
of binary, octal or hexadecimal number to decimal number is the
same;
• multiplication operation is used for the conversion.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 27
Conversion of Binary, Octal, Hexadecimal
to Decimal (Steps)
1. Find the sum of the Face Value * (from Base) position for each digit in
the number.
a) In a non-fractional number, the rightmost digit has position 0 and the
position increases as we go towards the left.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 28
Conversion of Binary, Octal, Hexadecimal
to Decimal (Steps)
b. In a fractional number, the first digit to the left of decimal point has
position 0 and the position increases as we go towards the left.
• The first digit to the right of the decimal point has position –1 and it
decreases as we go towards the right (–2, –3, etc.)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 29
Conversion of Binary, Octal, Hexadecimal
to Decimal (Steps)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 30
Conversion of Binary, Octal, Hexadecimal
to Decimal (example)
• Convert 1011 from Base 2 to Base 10.
• 1011 = 1*23 + 0*22 + 1*21 + 1*20
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 31
Conversion of Binary, Octal, Hexadecimal
to Decimal (example)
• Convert .1101 from Base 2 to Base 10.
• .1101 = 1*2–1+ 1*2–2 + 0*2–3 + 1*2–4
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 32
Conversion of Binary, Octal, Hexadecimal
to Decimal (example)
• Convert 1011.1001 from Base 2 to Base 10.
• 1011.1001 = 1*23 + 0*22 + 1*21 + 1*20 + 1*2–1 + 0*2–2 + 0*2–3 + 1*2–4
• = 8 + 0 + 2 + 1 + 1/2 + 0 + 0 + 1/16
• = 11+ 9/16 = 11.5625
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 33
Conversion of Binary to Octal, Hexadecimal
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 34
The Steps for Binary to Octal Conversion
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 35
Binary to Octal Conversion (Example)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 36
Binary to Octal Conversion (Example)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 37
Steps for Binary to Hexadecimal
• 1. Partition the binary number in groups of four bits, starting from the
right-most side.
• 2. For each group of four bits, find its hexadecimal number.
• 3. The result is the number formed by the combination of the
hexadecimal numbers.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 38
Binary to Hexadecimal (Example)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 39
Binary to Hexadecimal (Example)
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 40
Conversion of Octal, Hexadecimal to Binary
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 41
Steps for Hexadecimal to Binary
Conversion
• 1. Convert each hexadecimal number into a four-digit binary number
moving from right to left.
• 2. The result is the number formed by the combination of all the bits.
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 42
Conversion of Hexadecimal to Binary
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 43
Steps for Octal to Binary Conversion
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 44
Conversion of Octal to Binary
Jennifer T. Campbell, Discovering Computers: Digital Technology, Data, and Devices, 17th Edition. © 2023 Cengage. All Rights
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 45