Professional Documents
Culture Documents
Lecture 05
Lecture 05
FCIT– Semester 01
Information Technology
Ruchira ManikkaArachchi
1000 100 10 1
Example : 1492 1 x 1000 = 1000
4 x 100 = 400
9 x 10 = 90
2x1 =+ 2
1492
SLIIT Academy Pvt Ltd. © 2022
Binary Numbers
• The prefix “bi-” stands for 2
• The binary number system is a Base 2 number system:
• There are 2 symbols that represent quantities: 0, 1
• Each place value in a binary number is a power of 2.
Decimal
Binary Octal
Hexa-
Decimal
SLIIT Academy Pvt Ltd. © 2022
Converting Decimal Numbers to Binary Numbers
• There are two methods that can be used to convert decimal numbers to
binary:
• Repeated Division Method
• Repeated Subtraction Method
• Both methods produce the same result, and you should use whichever
one you are most comfortable with.
Conversion Steps:
• Divide the number successively by 2.
• After each division get the integer quotient for the next iteration and
record the remainder ➔ which is either 1 or 0
• Repeat the steps until the quotient is equal to 0.
• The result is read from the last remainder upwards.
0
853
Step 3: Subtract the largest place value from the decimal number. Place a
“1” under that place value.
853 – 512 = 341 Need to Place the 341
1024 512 256 128 64 32 16 8 4 2
0 1
341 SLIIT Academy Pvt Ltd. © 2022
The Repeated Subtraction Method
Step 4: 341 – 256 = 85 Need to Place the 85
Step 4:
For the rest of the place values, try to subtract each one from the previous result.
• If you can, place a “1” under that place value.
• If you can’ t, place a “0” under that place value.
Step 5:
Repeat Step 4 until all of the place values have been processed. The resulting set of 1s and 0s is
the binary equivalent of the decimal number you started with.
SLIIT Academy Pvt Ltd. © 2022
The Repeated Subtraction Method
Conversion Steps:
• Divide the number successively by 8.
• After each division get the integer quotient for the next iteration and
record the remainder which is a number in the range 0 to 7.
• Repeat the steps until the quotient is equal to 0.
• The result is read from the last remainder upwards.
Conversion Steps:
• Divide the number successively by 16.
• After each division get the integer quotient for the next iteration and
record the remainder which is a number in the range 0 to 9 and
A,B,C,D,E and F
• Repeat the steps until the quotient is equal to 0.
• The result is read from the last remainder upwards.
SLIIT Academy Pvt Ltd. © 2022
Practice Question 03
Convert the given Decimal numbers to Hexa-Decimal.
a) 12510
b) 35810
c) 45610
Conversion Steps:
• Take binary number
• Divide the binary digits into groups of three ,starting from right side.
• Convert each group of three binary digits to one octal digit.
*8 72
77
SLIIT Academy Pvt Ltd. © 2022
Converting Octal Numbers to Binary
Conversion Steps:
• Take the Octal number.
• Each octal digit is simply replaced by its 3-bit binary equivalent.
• It is important to remember that (say) 3 must be replaced by 011 and not
11.
* 16 272
277 SLIIT Academy Pvt Ltd. © 2022
Converting Hexadecimal Numbers to Binary
Conversion Steps:
• Take the Hexa-Decimal number.
• Each hexadecimal digit is replaced by its 4-bit binary equivalent.
0.125 * 2 = 0.250 0
0.250 * 2 = 0.500 0 0.12510 = 0.0012
0.500 * 2 = 1.000 1
0.000 * 2 = 0.000 Process Ends
22.510 = 10110.12
SLIIT Academy Pvt Ltd. © 2022
Conversion of Fractions:
Converting Binary Fractions to Decimal Fractions
Conversion Steps:
• Take the fractional binary number.
• Consider the right most none zero bit, divide by 2 (multiply by ½ ) and
add it to the bit on its left.
• Now take this result, divide by 2 (multiply by ½ ) and add it to the next bit
on the left.
• Continue in this way until the least significant bit has been added in.
SLIIT Academy Pvt Ltd. © 2022
Practice Question 13
Convert the given Binary Fractions to Decimal Fractions.
a) 0.101 2
b) 0.1101 2