You are on page 1of 31

Number System

Decimal,Binary
2nd Semester, SY 2023-2024
Bridging the Gap
1 6 23
6343 721 93355 3 16 6 3
2
Decimal-to-Binary
5 9
935
935
721 534 Conversion
234142715 37 2
1 3 75 3 4
5 7 1452

01 1 00
1 001 11
0 01 0 1 010 01100001
0
0 110 01
1 10 01
0 01 1
1
00100
1 1 0 0 1 10
0
1 10 1100 1
01
001
0 11 0 1 0 011 101
01 0 1 1 01
Binary-to-Decimal 11 0010 0010
0 1 1011
01 101 110 0
Conversion 1
010111101 100101011
1
0 1
1 001
0
0 1 011 1 00
011 1
00101
0 1 01
1 011 0
00
1 0100
2
Conversion Among Bases
• The possibilities:

Decimal Octal

Binary Hexadecimal

pp. 40-46
Conversion Among Bases
• Decimal to Binary & Binary to Decimal:

Decimal

Binary

pp. 40-46
• In the decimal number systems each of
the ten digits, 0 through 9, represents a
certain quantity.
• The position of each digit in a decimal
number indicates the magnitude of the
quantity represented and can be
assigned a weight.
• The weights for whole numbers are
positive powers of ten that increases
from right to left, beginning with 10º = 1
• ……………105 104 10³ 10² 10¹ 10º 5
Decimal ‒to‒ Binary Conversion
The Process : Successive Division
– Write down the decimal number.
– Divide the number by 2.
– Write the result underneath.
– Write the remainder on the right hand side. This
will be 0 or 1.
– Divide the result of the division by 2 and again
write down the remainder.
– Continue dividing and writing down remainders until
the result of the division is 0.
6
Decimal ‒to‒ Binary Conversion
The Process (cont’d) : Successive Division
– The first remainder is considered as the Least
Significant bit (LSB)
– The last remainder is the Most Significant Bit
(MSB).
– Read the series of 1’s and 0’s as the result of the
remaider – that will be the binary equivalent of the
decimal number.

7
Decimal ‒to‒ Binary Conversion

610  610 = 1102

3
2 6 r  0  Least Significant Bit
1
2 3 r 1
0
2 1 r  1  Most Significant Bit
8
Dec → Binary : Example #2
Convert the decimal number 2610
into its binary equivalent.

9
Solution : Example #2
Solution:
13
2 26 r  0  LSB  2610 = 110102
6
2 13 r 1
3
2 6 r 0
1
2 3 r 1
0
2 1 r  1  MSB
10
Dec → Binary : Example #3
Example:
Convert the decimal number 4110 into
its binary equivalent.

11
Solution : Example #3
Solution:
20
2 41 r  1  LSB  4110 = 1010012
10
2 20 r 0

5
2 10 r 0
2
2 5 r 1

1
2 2 r 0

0
2 1 r  1  MSB

12
Dec → Binary : Assignment

a) 1310 = ?

b) 2210 = ?

c) 4310 = ?

d) 15810 = ?
13
BINARY TO DECIMAL

14
Binary ‒to‒ Decimal Process
The Process : Weighted Multiplication
a) Multiply each bit of the Binary Number by it corresponding bit-
weighting factor (i.e. Bit-0→20=1; Bit-1→21=2; Bit-2→22=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.

Example:
Convert the binary number 01102 into its decimal equivalent.

0 1 1 0
23 22 21 20
Bit-Weighting  0110 2 = 6 10
8 4 2 1 Factors

0 + 4 + 2 + 0 = 610

15
Converting Base-2 to Base-10
1( 0 0 1 2 ) 1

OFF

ON
OFF

ON
ON
ON/OFF

:Exponent 24 23 22 21 20

16 0 0 2 1
:Calculation + + + + =

10) 19 (
16
Binary → Dec : Example #1
Example:

Convert the binary number 100102 into its


decimal equivalent.

Convert the binary number 01101012 into its


decimal equivalent.
17
Binary → Dec : Example #1
Example:
Convert the binary number 100102 into its decimal equivalent.

Solution:

1 0 0 1 0
24 23 22 21 20

16 8 4 2 1

16 + 0 + 0 + 2 + 0 = 1810

100102 = 1810
18
Binary → Dec : Example #2
Example:
Convert the binary number 01101012 into its decimal
equivalent.

19
Binary → Dec : Example #2
Example:
Convert the binary number 01101012 into its decimal
equivalent.
Solution:

0 1 1 0 1 0 1
26 25 24 23 22 21 20

64 32 16 8 4 2 1

0 + 32 + 16 + 0 + 4 + 0 + 1 = 5310

01101012 = 5310
20
Decimal to Octal

Octal number:

•These are the numbers with base 8.


•If x is a number then the octal number is
denoted as x8.
•It contains digits from 0 to 7. Example: (212) 8,
(121)8, etc.

21
Decimal to Octal : Steps

1. If the given decimal number is less than 8 the octal


number is the same.
2. If the decimal number is greater than 7 then divide the
number by 8.
3. Note the remainder, we get after division
4. Repeat step 3 and 4 with the quotient till it is less than 8
5. Now, write the remainders in reverse order (bottom to
top)
6. The result is the equivalent octal number to the given
decimal number.

22
Decimal to Octal

• Convert 12710 to Octal.


• Solution: Divide 127 by 8
• 127 ÷ 8= 15(Quotient) and (7)Remainder
• Divide 15 by 8 again.
• 15 ÷ 8 = 1 (Quotient) and (7) Remainder
• Divide 1 by 8, we get;
• 1 ÷ 8 = 0 (Quotient) and (1) Remainder
• Since the quotient is zero now, no more division can
be done, so the octal equivalent : (127)10 = (177)8
23
Decimal to Octal

• Example 2: Convert 5210 to octal.


• Solution: Divide 52 by 8
• 52 ÷ 8 = 6(Quotient) and (4)Remainder
• Divide 6 by 8 again.
• 6 ÷ 8 = 0(Quotient) and (6) Remainder
• Since the quotient is zero now, no more division can be
done. So by taking the remainders in reverse order, we get
the equivalent octal number.
• (52)10 = (64)8

24
Decimal to Octal

Example 3:convert 35910 to octal.


•Each successive division by 8 yields a remainder
that becomes a digit in the equivalent octal
number.
•The first remainder generated is the least
significant digit (LSD).
8 359 = 44.875 0.875 x 8 = 7 (LSD)
8 44 = 5.5 0.5 x 8 = 4
8 5 5

Therefore; 35910 = 5478 25


Ass: Pls answer the following :

Choose four decimal number between

56710 to 122810
•Convert to Octal
•Decimal to Hexa
•Show the process
•Pls refer to slide #22 to 25 (lesson re:
Decimal to Octal)
26
Decimal-to-Hexadecimal Conversion

• Hexa is base 16
• Repeated division of a decimal number by 16 will
produce the equivalent hexadecimal number,
formed by the remainders of the divisions.
• The first remainder produced is the least significant
digit (LSD).
• Each successive division by 16 yields a remainder
that becomes a digit in the equivalent hexadecimal
number. When a quotient has a fractional part, the
fractional part is multiplied by the divisor (16) to get
the remainder.
27
• In Decimal to Hexa conversion .pls refer to the
table below:

• Note: Remember, from 0 to 9, the numbers will be counted as the same in


the decimal system. But from 10 to 15, they are expressed
in alphabetical order such as A, B, C, D, E, F

28
Decimal-to-Hexadecimal Conversion

• Convert the decimal number 65010 to hexa

16 650 = 40.625 0.625 x 16 = 10 A (LSD)


16 40 = 2.5 0.5 x 16 = 8
16 2 = 0.125 0.125 x 16 = 2 (MSD)

• The hexadecimal number is 28A

29
Decimal-to-Hexadecimal Conversion
Example: 96010 to a hexadecimal number
follow the steps given below:
1) First, divide 960 by 16.
960 ÷ 16 = 60 and remainder = 0
2) Again, divide quotient 60 by 16.
60 ÷ 16 = 3 and remainder 12.
3) Again dividing quotient 3 by 16, will leave quotient=0 and
remainder = 3.
4) Now taking the remainder in reverse order and substituting the
equivalent hexadecimal value for them, we get,
3 = 3, 12 = C and 0 = 0
•Therefore, 96010 = 3C016
30
References:
• Microsoft, Inc. (2022). Clip Art. Retrieved
January 15, 2023 from
http://office.microsoft.com/en-us/clipart/default.a
spx
• https://owlcation.com/stem/How-to-Convert-Deci
mal-to-Binary-and-Binary-to-Decimal
• https://byjus.com/maths/decimal-to-hex-conversi
on/

31

You might also like