Unit 2 (1-24)
Unit 2 (1-24)
The number system plays a vital role in computer calculations. Number system is an
organized and systematic way of representing numbers. Number systems are basically of
two types: non-positional and positional number systems.
The non-positional number system is a number system in which each symbol represents
the same value, regardless of its position in the number. The symbols are simply added to
find out the value of a particular number. The most common non-positional number system
is the Roman Number System. It is a system of representing numbers devised by the
ancient Romans. It is based on certain letters which are given values as numerals.
Positional number system can be represented by a few symbols called digits, which
represent different values depending on the position that they occupy. The value of each
digit in such a number is determined by the digits itself, the position of the digit in the
number, and by the base of the number system. The main positional number systems used
in computer are decimal, binary, octal and hexadecimal.
a. Decimal number system: A number system having base or radix 10 is called decimal
number system.
Examples: (789)10 or (789)D
b. Binary number system: A number system having base or radix 2 is called binary number
system.
Examples: (110)2
c. Octal number system: A number system having base or radix 6 is called octal number
system.
Examples: (1234)8
(1)
The base or radix of a number system is the number of different symbols available to
represent any digit within that system. For example, the decimal system (Base 10) has a
radix of 10. Decimal uses different combinations of 10 symbols to represent any value (i.e.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
An electronic circuit has two states either ON state or OFF state. The bit 1 represents the
high voltage i.e. ON state and the bit 0 represents the low voltage i.e. OFF state of an
electronic circuit. So it is used in computer system.
Number
Conversion
1. Decimal Number System to Others (Binary, Octal, Hexa-Decimal) Number System = Divide (2,8,16)
2. Others (Binary, Octal, Hexa-Decimal) Number System to Decimal Number System= Multiply (2,8,16)
3. Binary Number system to Octal Number system and Vice versa = 3 bit binary Grouping Method (421)
4. Binary Number System to Hexa-Decimal Number System and Vice versa= 4 bit binary Grouping Method
( 8421)
5. Octal Number System to Hexa-decimal Number System and Vice versa= 3 bit & 4 bit groping Method
(421 & 8421)
(2)
3
3 bit binary grouping method (421) Octal (8)
(3)
b. Decimal to Octal
Here, (804)10
8 804 4
8 100 4
8 12 4
8 1 1
0
= 32 + 0 + 0 + 4 + 0 + 0
= (36)10
e. Octal to Decimal
Here, (2040)8 = 83 x 2 + 82 x 0 + 81 x 4 + 80 x 0
= 1024 + 32
= (1056)10
f. Hexa-decimal to
Decimal
Here, (1E0D)16 = 163 x 1 + 162 x E + 161 x 0 + 160 x D
= 4096 + 256 x 14 + 0 + 1 x 13
= 4096 + 3584 + 13
= (7693)10
g. Binary to Octal
Here, (110111101)2
(4)
110 111 101 (: 3 bit binary grouping method )
6 7 5
h. Binary to Hexa-decimal
Here, (1001110111)2
2 7 7
i. Octal to Binary
Here, (375)8
3 7 5
j. Hexa-decimal to Binary
Here, (ABC)16
A B C
k. Octal to Hexa-decimal
Here, (555)8
5 5 5
= (101101101)2
0001 0110 1101
1 6 D
(5)
l. Hexa-decimal to
Octal Here,
(BCA)16
B C A
= (101111001010)16
101 111 001 010
5 7 1 2
Therefore, (BCA)16 = (5712)8
0.1 x 2 = 0.2 0
0.2 x 2 = 0.4 0
0.4 x 2 = 0.8 0
0.8 x 2 = 1.6 1
0.6 x 2 = 1.2 1
Therefore, (0.55)10 = (0.100011)2
b. Decimal to Octal
Here, (234.997)10
8 234 2
8 29 5
8 3 3
0
Also
0.997 x 8 = 7.976 7
0.976 x 8 = 7.808 7
(6)
0.808 x 8 = 6.464 6
0.464 x 8 = 3.712 3
0.712 x 8 = 5.696 5
0.696 x 8 = 5.568 5
Therefore, (234.997)10 = (352.776355)2
d. Binary to
Decimal
Here, (101.1101)2 = 22 x 1 + 21 x 0 + 20 x 1 + 2-1 x 1 + 2-2 x 1 + 2-3 x 0 + 2-4 x 1
e. Octal to Decimal
Here, (0.1042)8 = 8-1 x 1 + 8-2 x 0 + 8-3 x 4 + 8-4 x 2
= (0.1333)10
(7)
f. Hexa-decimal to
Decimal
Here, (FA.AEF)16 = 161 x 15 + 160 x 10 + 16-1 x 10 + 16-2 x 14 + 16-3 x 15
= 250.68335
g. Binary to Octal
Here, (101010.110111)2
h. Binary to Hexa-
decimal
Here, (10101.11011)2
i. Octal to Binary
Here, (77.226)8
7 7 2 2 6
j. Octal to Hexa-
decimal
Here, (0.376)8
3 7 6
011 111 110
= (011111110)2
0111 1111
7 F
Therefore, (0.376)8 = (0.7F)10
(8)
k. Hexa-decimal to Binary
Here, (0.5AB)16
5 A B
0101 1010 1011
Therefore, (0.5AB)16 = (0.010110101011)2
(9)
2.1.2 Binary Arithmetic Rule for addition
a. Binary Addition 0+0=0
0+1=1
Here, 1111+1111=11110 1+0=1
1+1=10 (0 with carry over 1)
1+1+1=11 (1 with carry over 1)
1+1+1+1=100 (0 with carry over 10)
1+1+1+1+1=101 (0 with carry over 10)
b. Binary Subtraction
Here, 1100 - 11
1100
- 0011 Rule for Subtraction
1001 0-0=0
1-0=1
Here, 101010 - 1001 1-1=0
101010 0-1=1 (with borrowing 1 from left side
- 001001 Then it becomes 10 i.e. 10-1=1)
100001
c. Binary Multiplication
Here, 1010 x 1010
1010 Rule for Multiplication
x1010 0x0=0
1x0=0
0000 0x1=0
1x1=1
1010x
0000xx
1010xxx
1100100
(10)
d. Binary Division
Here, 110100 / 110
100
1001
________
1000
0000
_______
10000
01001
_______
1110
1001
_____
1011
1001
______
10
Therefore, Quotient = 10111 and Remainder = 10
(11)
A compliment is process of representing the negative numbers or bits in digital computer system.
Complements are used in digital computers for simplifying the subtraction operation and for
logical manipulation. Using complements, all the arithmetic operators can be performed in the
form of addition.
(12)
1'S AND 2'S COMPLEMENT BINARY SUBTRACTION METHOD
1. Subtract 110 from 1101 using 1's complement binary subtraction method.
Using 1's complement method:
Here Main value=
1101
Second Value= 110
1 0110
Here, we got overflow bit so discard it and add the remaining part.
0110 + 1 = 0111
1 0111
Here, we got overflow bit which is discarded and the remaining part is our answer.
Thus, 1101 - 110 = 111
2. Subtract 1111 from 1100 using 1's and 2's complement binary subtraction method.
Here, Main value =1100
Second value= 1111 Both
are equal digit.
Using 1's complement method:
i. 1's complement of second value 1111 is 0000. ii.
Add both the bits:
1100
+ 0000
1100
(13)
Here, we did not get overflow bit so we again calculate 1's complement of 1100 i.e. 0011 and
put minus sign before it. Thus, 1100 - 1111 = -11
1. Subtract 123 from 1234 using 9's and 10's decimal subtraction method.
Using 9's complement method:
Main value=1234
Second value=123
i. Making the numbers equal in both minuend and subtrahend as 1234 and 0123.
ii. 9's complement of 0123 is (9999-0123) = 9876.
iii. Adding both numbers:
1234
+ 9876
1 1110
Here, we got overflow digit, so we discard it and add it to the remaining part.
Thus, 1110 + 1 = 1111
Second value=123
1234
+ 9877
(14)
1 1111
Here, we got overflow digit, so we discard it and remaining will the answer.
Thus, 1234 - 123 = 1111
2. Subtract 4567 from 567 using 9's and 10's decimal subtraction method.
Using 9's complement method:
Main value= 567
0567
+ 5433
6000
Here, we did not get overflow digit, so we again calculate 10's complement of it.
i.e. (9999-6000)= 3999 + 1 = 4000
A logic function is an expression algebraically with binary variables, logical operation symbols,
parenthesis and equal sign, is known as Boolean function. Example, F= A.B.C'+A.B
Truth Table:
(15)
Truth table is a table which represents all the possible values of logical variables/statements along
with all the possible results of the given combinations of values. For example, following logical
statements can have only one of the two values (TRUE (YES) or FALSE (NO)).
1. AND Gate: AND gate generates true output if all the inputs are true, otherwise it generates false
output. It is denoted by (.) operator and graphically represented by: Logical Symbol
Truth Table
Input Output
A B F=A.B
0 0 0
0 1 0
1 0 0
1 1 1
2. OR Gate: OR gate generates true if at least any one of the input is true, otherwise it generates
false Output. It is denoted by (+) operator and graphically represented by: Logical Symbol
Truth Table
Input Output
A B F=A+B
0 0 0
0 1 1
1 0 1
1 1 1
3. NOT Gate: It is also known as inverter. It inverts the input state from true to false and vice versa.
It is denoted by (_) or (') operator and graphically represented by: Logical Symbol
(16)
Truth Table
Input Output
A F=A'
0 1
1 0
4. NAND Gate: NAND gate is the combination of AND and NOT gate. NAND gate generates true (1)
output if at least any of the input is false otherwise, it generates false output. Graphically it is
represented by: Logical Symbol
5. NOR Gate: NOR gate is the combination of the OR gate and NOT gate. This electronic gate
produces True (1) output when all inputs are False (0) otherwise the output will be False (0). It is
the complement of the OR gate. It has two or more inputs and only one output.
Logical Symbol:
The truth-table of NOR gate is:
Input Output
A B (A+B) F=(A+B)'
0 0 0 1
0 1 1 0
(17)
1 0 1 0
1 1 1 0
6. Exclusive (X-OR)Gates:
The XOR gate produces false output (0) when both the inputs are same otherwise, the output
will be true (1). It can also have two or more inputs which produces only one output. Logical
Symbol:
Inputs Output
0 0 1 1 0 0 0
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0
7. Exclusive-NOR(X-NOR) Gate:
The XNOR (exclusive-NOR) gate is a combination XOR gate followed by an inverter. Its output is
"true" if the inputs are the same and output is "false" if the inputs are different. The X-NOR gate
symbol is given below:
(18)
Input Output
0 0 1 1 1 0 1
0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 1 0 0 0 1 1
b. Theorem 2: The complement of a product of variables is equal to the sum of the complement
of each variables.
(A.B)' = A' + B'
(19)
Duality principle:
Duality principle state can be obtained by replacing AND (.) with OR (+) and vice versa, 1 with 0 and
vice versa keeping variables and complements and variables are unchanged. For example, duality
of the expression A.B' = A+B' and A'.B+C = A'+B.C
7.
a.
b.
c.
d.
8.
Associative law states that when ORing or ANDing more than two variables, the result is the same
regardless of the grouping of the variables.
(a) (A + B) + C = A + (B + C)
(20)
Distributive law states that ORing/ANDing two or more variables and then ANDing/ORing the result
with a single variable is equivalent to ANDing/ORing the single variable with each of the two or more
variables and then ORing/ANDing the products/sums. (a) A (B + C) = A.B + A . C
9.
a.
Here,
AB + A'BC + BC
= AB + BC(A'+1)
=AB + BC
(21)
=B(A + C)
b.
Here,
= PQ' + PQ + QQ + PP' + PQ
= PQ' + PQ + Q + 0
= P(Q'+Q) + Q
=P+Q
P Q P+Q
0 0 0
0 1 1
1 0 1
(22)
1 1 1
c.
Here,
= XY' + XYZ
= X(Y'+YZ)
= X(Y'+ Z)
(23)
10. Here, a
= A.B.C b =
A' + B + C
c = A'.B'.C
= B + A' + C + A'B'C
= A' + B' + C
Principle of duality
➢ Changing to symbol OR (+) operation from AND (.) operation or AND (.) operation from OR (+)
operation and digits 0 and 1 that is called principle of duality. ➢ Example, (x+y).z=(x.y)+z
Uses of gates
➢ Logical function are useful not only to the hardware designer in implementing circuits but also
to software designer in making decision, performing arithmetic, recognizing characters and
patterns, checking for errors, formatting output and assembling and disassembling data.
(24)
(24)