0% found this document useful (0 votes)
73 views

Number System in Computers:: Decimal and Binary Numbers

The document discusses number systems used in computers, including binary, decimal, and hexadecimal. It explains how decimal numbers use base 10, with digits in place values of hundreds, tens, ones, etc. Binary uses base 2, with each digit representing a power of 2. Methods to convert between decimal, binary, and hexadecimal are provided with examples. Hexadecimal uses base 16 and digits 0-9 plus letters A-F. Common uses of these number systems in digital systems and computing are also mentioned.

Uploaded by

Learn Islam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Number System in Computers:: Decimal and Binary Numbers

The document discusses number systems used in computers, including binary, decimal, and hexadecimal. It explains how decimal numbers use base 10, with digits in place values of hundreds, tens, ones, etc. Binary uses base 2, with each digit representing a power of 2. Methods to convert between decimal, binary, and hexadecimal are provided with examples. Hexadecimal uses base 16 and digits 0-9 plus letters A-F. Common uses of these number systems in digital systems and computing are also mentioned.

Uploaded by

Learn Islam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

(1) Number system in Computers:

Decimal and Binary Numbers


When we write decimal (base 10) numbers, we use a positional notation system. Each digit is
multiplied by an appropriate power of 10 depending on its position in the number:
For example: 843 = 8 x 102 + 4 x 101 + 3 x 100
= 8 x 100 + 4 x 10 + 3 x 1
= 800 + 40 + 3 => 803
For whole numbers, the rightmost digit position is the one’s position (10 0 = 1). The numeral in that
position indicates how many ones are present in the number. The next position to the left is ten’s,
then hundred’s, thousand’s, and so on. Each digit position has a weight that is ten times the weight
of the position to its right.
In the decimal number system, there are ten possible values that can appear in each digit position,
and so there are ten numerals required to represent the quantity in each digit position. The decimal
numerals are the familiar zero through nine (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
In a positional notation system, the number base is called the radix. Thus, the base ten system that
we normally use has a radix of 10. The term radix and base can be used interchangeably. When
writing numbers in a radix other than ten, or where the radix isn’t clear from the context, it is
customary to specify the radix using a subscript. Thus, in a case where the radix isn’t understood,
decimal numbers would be written like this:
12710 1110 567310
Generally, the radix will be understood from the context and the radix specification is left off.
The binary number system is also a positional notation numbering system, but in this case, the base
is not ten, but is instead two. Each digit position in a binary number represents a power of two. So,
when we write a binary number, each binary digit is multiplied by an appropriate power of 2 based
on the position in the number:
Example: 101101 = 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 8 + 4 + 1 => 45
In the binary number system, there are only two possible values that can appear in each digit
position rather than the ten that can appear in a decimal number. Only the numerals 0 and 1 are
used in binary numbers. The term ‘bit’ is a contraction of the words ‘binary’ and ‘digit’, and when
talking about binary numbers the terms bit and digit can be used interchangeably. When talking
about binary numbers, it is often necessary to talk of the number of bits used to store or represent
the number. This merely describes the number of binary digits that would be required to write the
number. The number in the above example is a 6 bit number.
The following are some additional examples of binary numbers:
1011012 112 101102
Conversion between Decimal and Binary
Converting a number from binary to decimal is quite easy. All that is required is to find the decimal
value of each binary digit position containing a 1 and add them up.
For example: Convert 101102 to decimal.
1 0 1 1 0
\ \ \___________1 x 21 = 2
\ \____________1 x 22 = 4
\_______________1 x 24 = 16
22
Another example: convert 110112 to decimal
1 1 0 1 1
\ \ \ \_________1 x 20 = 1
\ \ \__________1 x 21 = 2
\ \_____________1 x 23 = 8
\______________1 x 24 = 16
27
The method for converting a decimal number to binary is one that can be used to convert from
decimal to any number base. It involves using successive division by the radix until the dividend
reaches 0. At each division, the remainder provides a digit of the converted number, starting with the
least significant digit.
An example of the process: convert 3710 to binary
37 / 2 = 18 remainder 1 (least significant digit)
18 / 2 = 9 remainder 0
9 / 2 = 4 remainder 1
4 / 2 = 2 remainder 0
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (most significant digit)
The resulting binary number is: (100101)2
Another example: convert (93)10 to binary
93 / 2 = 46 remainder 1 (least significant digit)
46 / 2 = 23 remainder 0
23 / 2 = 11 remainder 1
11 / 2 = 5 remainder 1
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (most significant digit)
The resulting binary number is: (1011101)2
Hexadecimal Numbers
In addition to binary, another number base that is commonly used in digital systems is base 16. This
number system is called hexadecimal, and each digit position represents a power of 16. For any
number base greater than ten, a problem occurs because there are more than ten symbols needed
to represent the numerals for that number base. It is customary in these cases to use the ten decimal
numerals followed by the letters of the alphabet beginning with A to provide the needed numerals.
Since the hexadecimal system is base 16, there are sixteen numerals required. The following are the
hexadecimal numerals:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
The following are some examples of hexadecimal numbers:
1016 4716 3FA16 A03F16
Example: Convert the binary number (10110101)2 to a hexadecimal number

Divide into groups for 4 digits 1011=B 0101 =5

Convert each group to hex digit (B5)16

Example: Convert the binary number (0110101110001100)2 to hexadecimal


Divide into groups of 4 digits 0110 1011 1000
1100

Convert each group to hex digit 6 B 8


C

(6B8C)16

To convert a hexadecimal number to a binary number, convert each hexadecimal digit into a group of
4 binary digits.
Example: Convert the hex number (374F)16 into binary
3 7 4 F
Convert the hex digits to binary 0011 0111 0100 1111
(0011011101001111)2
Powers of 2:
20−−−−−−−−−−−1
21−−−−−−−−−−−2
22−−−−−−−−−−−4
23−−−−−−−−−−−8
24 −−−−−−−−−−−16
25−−−−−−−−−−−32
26−−−−−−−−−−−64
27−−−−−−−−−−−128
28−−−−−−−−−−−256
Hexadecimal Digits
0 ......................0 0
0
0 ASCII Character Set
0
High Order Bits
1 ......................1 0
0
Low 000 00 0010 00 01 01 01 01
0
Order 0 01 11 00 01 10 11
1
Bits 0 1
2 ......................2 2 0 3 4 5 6 7
0
000 0 NU DL Spac 0 @ P ` p
1
0 L E e
0
000 SO DC
1 3 ......................3 !0 1 A Q a q
1 H 1 0
1
001 2 ST DC “1 2 B R b r
0 X 2
4 ......................4 0
001 3 ET DC #1 3 C S c s
1 X 3 0
0
010 4 EO DC $ 4 D T d t
5 ......................5
T 4 0
0
1
010 5 EN NA %0 5 E U e u
1 Q K 1
6 ......................6 0
011 6 AC SY &1 6 F V f v
0 K N
1
0
011 7 BE ET ‘ 7 G W g w
1 L B
7 ......................7 0
1
100 8 BS CA (1 8 H X h x
0 N 1

100 9 8 ......................8
HT EM )1 9 I Y i y
1 0
0
101 A LF SU *0 : J Z j z
0 B
9 ......................9 1
101 B VT ES +0 ; K [ k {
C 0
1
1
110 FF FS A
C 10..................... ,1 < L \ l |
0 0
1
110 D CR GS - = M ] m }
0
1
11..................... B 1
111 E SO RS .0 > N ^ n ~
0 1
1
111 F SI US / ? O _ o DE
1 12..................... C 1 L
1
0
0
13..................... D 1 (2)Logics
1
0 SYMBOLIC REPRESENTATION
1 2. :
14..................... E 1 Statements are symbolically represented by letters
1 such as p, q, r,...
1
0
15......................F 1
1
1
1
4.
EXAMPLES:
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
5.

CONNECTIVE MEANING SYMBOL CALLED


S
Negation not ~ Tilde

Conjunction and Hat

Disjunction or Vel

Conditional if…then… Arrow

Biconditional if and only Double arrow


EXAMPLES: if
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
p  q = “Islamabad is the capital of Pakistan and 17 is divisible by 3”
p  q = “Islamabad is the capital of Pakistan or 17 is divisible by 3”
~p = “It is not the case that Islamabad is the capital of Pakistan” or simply
“Islamabad is not the capital of Pakistan”

7.
TRANSLATING FROM ENGLISH TO SYMBOLS
8. :
Let p = “It is hot”, and q = “It is sunny”
SENTENCE SYMBOLIC FORM
1. It is not hot. ~p
2. It is hot and sunny. p q
3. It is hot or sunny. pq
4. It is not hot but sunny. ~ p q
5. It is neither hot nor sunny. ~p~q
EXAMPLE
9. :
Let h = “Zia is healthy”
w = “Zia is wealthy”
s = “Zia is wise”
Translate the compound statements to symbolic form:
1. Zia is healthy and wealthy but not wise. (h  w)  (~s)
2. Zia is not wealthy but he is healthy and wise. ~w  (h  s)
3. Zia is neither healthy, wealthy nor wise. ~h  ~w  ~s
14.
NEGATION (~)
16. :
If p is a statement variable, then negation of p, “not p”, is denoted as “~p”
It has opposite truth value from p i.e.,
if p is true, ~p is false; if p is false, ~p is true.
TRUTH TABLE FOR ~ p
18.

CONJUNCTION ()
20. :
“If p and q are statements, then the conjunction of p and q is “p and q”, denoted as “p  q”.”
It is true when, and only when, both p and q are true. If either p or q is false, or
if both are false, pq is false.
TRUTH TABLE FOR pq

p q p q

T T T
T F F
F T F
F F F
DISJUNCTION () or INCLUSIVE OR
22.
“If p & q are statements, then the disjunction of p and q is “p or q”, denoted as
“p  q””.
It is true when at least one of p or q is true and is false only when both p and q are false.
TRUTH TABLE FOR pq
24.

p q p q
T T T
T F T
F T T
Note F F F
It that in the table F is only in that row where both p and q have F and all other values
are T. Thus for finding out the truth values for the disjunction of two statements we
will only first search out where the both statements are false and write down the F in the
corresponding row in the column of p Ú q and in all other rows we will write T in the column of p
Ú q.
Remark:
Note that for Conjunction of two statements we find the T in both the statements, but
in disjunction we find F in both the statements. In other words we will fill T first in the column of
conjunction and F in the column of disjunction.

Truth Tables
Truth Tables for:
1. ~pq
2. ~ p  (q  ~ r)
3. (pq)  ~ (pq)
Truth table for the statement form ~ p  q

p q ~p ~p q
T T F F
T F F F
F T T T
F F T F
Double Negative Property ~(~p)  p

Example

“It is not true that I am not happy”

Solution:

Let p = “I am happy”

then ~ p = “I am not happy”

and ~(~ p) = “It is not true that I am not happy”

Since ~ (~p)  p

Hence the given statement is equivalent to:

“I am happy”

~ (pq) and ~p  ~q are not logically equivalent

p q ~p ~q pq ~(pq) ~p ~q
T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T
Gates and Circuits
1. NOT-gate
A NOT-gate (or inverter) is a circuit with one input and one output signal. If the input signal is 1,
the output signal is 0. Conversely, if the input signal is 0, then the output signal is 1.
P R
NOT

Input Outp
P R
ut
1 0
0 1
2. AND-gate
An AND-gate is a circuit with two input signals and one output signal.

If both input signals are 1, the output signal is 1. Otherwise the output signal is 0.

Symbolic representation & Input/Output Table


In Ou
Pp Q tpu
R
ut t
1 1 1
1 0 0
0 1 0
0 0 0
3. OR-gate
An OR-gate is a circuit with two input signals and one output signal.

If both input signals are 0, then the output signal is 0. Otherwise, the output signal is 1.

Symbolic representation & Input/Output Table

P
Inpu Ou
R
Q OR P tQ tpu
R
t
1 1 1
COMBINATIONAL CIRCUIT 1 0 1
:
0 1 1
0 0 0
A Combinational Circuit is a compound circuit consisting of the basic logic gates such as NOT,
AND, OR.
DETERMINING OUTPUT FOR A GIVEN INPUT

Indicate the output of the circuit below when the input signals are P = 1, Q = 0 and R = 0

P
AND NOT
Q

OR
S
R
SOLUTION

:
Output S = 1

CONSTRUCTING THE INPUT/OUTPUT TABLE FOR A CIRCUIT

Construct the input/output table for the following circuit.

P
AND NOT
Q
S
OR
R

LABELING INTERMEDIATE OUTPUTS

P X Y
AND NOT
Q
S
P Q R X Y S
OR
R 1 1 1 1 0 1
1 1 0 1 0 0
1 0 1 0 1 1
1 0 0 0 1 1
0 1 1 0 1 1
0 0 1 0 1 1
0 0 0 0 1 1

FINDING A BOOLEAN EXPRESSION FOR A CIRCUIT

P
OR
Q
AND

R OR

SOLUTION

Trace through the circuit from left to right, writing down the output of each logic gate.
P PQ

Q OR
(PQ)  (PR)
PR AND

R OR

Hence (PQ) (PR) is the Boolean expression for this circuit.

EXERCISE
Construct circuit for the Boolean expression (PQ)  ~R

SOLUTION:

P PQ
Q AND (P  Q)  ~R

OR
~R
R NOT
CIRCUIT FOR INPUT/OUTPUT TABLE

INPUTS OUTPUT
P Q R S
1 1 1 0
1 1 0 1
1 0 1 0
0 1 1 1
0 1 0 0
0 0 1 0
0 0 0 0

CIRCUIT DIAGRAM
P
:
Q AND S
R
OR
P
~P  Q  R
Q AND
R

EXERCISE:
P
Q AND

NOT
OR
AND

SOLUTION
AND
:
NOT
We find the Boolean expressions for the circuits and show that they are logically

Equivalent, when regarded as statement forms.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy