0% found this document useful (0 votes)
14 views26 pages

ICT-Lecture-04 Number System Arithmetic

Lecture 05 of CSC 101 covers number systems including binary, octal, and hexadecimal arithmetic operations such as addition, subtraction, multiplication, and division. It emphasizes the importance of data representation, efficient hardware design, and error detection. The lecture also provides examples and exercises for practice in binary and octal calculations.

Uploaded by

iamsaksaksak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views26 pages

ICT-Lecture-04 Number System Arithmetic

Lecture 05 of CSC 101 covers number systems including binary, octal, and hexadecimal arithmetic operations such as addition, subtraction, multiplication, and division. It emphasizes the importance of data representation, efficient hardware design, and error detection. The lecture also provides examples and exercises for practice in binary and octal calculations.

Uploaded by

iamsaksaksak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Lecture 05

CSC 101 – Introduction


to Computing
Number system
 Data Representation
 Efficient Hardware Design
 Ease of Processing
 Human Interaction and
Abstraction
 Data Storage and Transmission
 Error Detection and Correction
 Memory Addressing

2
Number system Addition and
Subtraction

Binary arithmetic
 Simplicity in Hardware Design
 Efficiency in Processing
 Error Detection and Correction
 Compact Representation
 Compatibility with Boolean Logic
 Scalability

3
Number system Addition and
Subtraction

 Binary addition and subtraction


 Octal addition and subtraction
 Hexadecimal addition and
subtraction

4
Addition
In binary arithmetic, the process of adding two binary numbers is
called binary addition. Where, the binary numbers consist of only
0 and 1. In the binary addition, a carry is generated when the sum
is greater than 1.

Rules for binary addition


Example
 Steps:-
 Add 1 (rightmost bit of first number) and 0 (rightmost bit of the second
number). It gives 1 + 0 = 1 (thus, write down 1 as sum bit).
 Add 0 (second rightmost bit of first number) and 1 (second rightmost bit
of the second number). It gives 0 + 1 = 1 (write down 1 as sum bit).
 Add 1 (third rightmost bit of first number) and 1 (third rightmost bit of
second number). It gives 1 + 1 = 10 (write down 0 as sum and 1 as
carry).
 Add 1 (leftmost bit of the first number), 1 (leftmost bit of second number)
and 1 (carry). It gives 1 + 1 + 1 = 11 (write down 1 as sum and 1 as
carry).
 Write the end around carry 1 in the sum.
Example
Excercises

 0101 + 1000
 1101
 1010 + 0011
 1101
 1010 + 1110
 1 1000
Binary subtraction
 In binary arithmetic, binary subtraction is a mathematical
operation used to find the difference between two binary
numbers.
 In binary subtraction, each bit of the binary numbers is
subtracted, starting from the rightmost bit.
 Also, a borrow bit can be taken from higher bits if require.

 Rules for binary subtraction


Binary subtraction
 Steps
 Subtract 0 (rightmost bit of second number) from 1 (rightmost
bit of first number). It gives 1 – 0 = 1 (write down 1 as
difference).
 Subtract 0 (second rightmost bit of second number) from 0
(second rightmost bit of first number). It gives 0 – 0 = 0 as
result.
 Subtract 1 (third rightmost bit of second number) from 1 (third
rightmost bit of first number). It gives 1 – 1 = 0 as result.
 Subtract 1 (leftmost bit of second number) from 1 (leftmost bit
of first number). It gives 1 – 1 = 0 as result.
Binary subtraction
 Subtract rightmost bits: 1 – 1 = 0

 Subtract second rightmost bits: 1 – 1 = 1

 Subtract third rightmost bits: 1 – 1 = 0

 Subtract leftmost bits: 1 – 0 = 1


Excercises

 1011011 – 10010
 1001001
 0011010 - 001100
 0001110
 10010110 - 1111010
 10011100
 1101101 - 11011
 1010010
Binary Subtraction
 1101 – 0111
 0110
 1010010 – 111111
 0010011
 100001 – 1111
 010010
 Represent -15 in binary
 102 - 110
 10110100 (180) - 10010101(149)
 00011111
 11101011(235) – 01100110(102) (both methods)
 10000101
Binary multiplications
 Multiply the rightmost bit of the second number,
1 by each bit of the first number (1101).

 Now, shift the partial product one position to the


left to perform the next multiplication.

 Multiply the leftmost bit of the second number, 1


by each bit of the first number (1101).

 Finally, sum up all the partial products to obtain


the final product.
Binary multiplications
Binary multiplications
 0011010 x 001100 = 0100111000
Binary divisions
 Rules of Binary Division
 The following rules of binary arithmetic are utilized while
diving one binary number by another −
 0÷0=Undefined
 0÷1=0withRemainder=0
 1÷0=Undefined
 1÷1=1withRemainder=0
Octal Addition
Octal Addition
 Add the octal digits in the rightmost column: 5 + 2 = 7.
Write down the digit 7 as result.
 Move to the second column and add the octal digits 1
and 2: 1 + 2 = 3. Write down the digit 3 as result.
 Move to the next column and add the octal digits in the
third column: 3 + 2 = 5. Write down the digit 5 as
result.
 Hence, the final result of octal addition of 315 and 222
is 537.
 372+716
 1310
 642 + 321
 1 163
 146 + 136
 304
Octal Subtraction
 Startsubtracting from the digits in the rightmost
column: 5 – 3 = 2. Write down the digit 2 as
result.

 Move to the next column and subtract the digits:


2 – 1 = 1. Write down the digit as result.

 Move to the next column and subtract the octal


digits: 3 – 2 = 1. Write down the digit 1 as result.

 Thus,the final result of the given octal


subtraction is (112)8.
Octal Subtraction

 317 – 125 = 172


Octal Subtraction

 456 – 173
 = 263
 743 – 564
 =157
 624 - 265
 337
 2046 - 653
 1173
Hexadecimal Addition
Hex addition

 8AB + 93C
 1 1E7
 8AB + B78
 1423
 899 + 189
 A22
 DAF+BAF
 195E
Hexadecimal
Subtraction
 9654 - 5321
 4333
 5DC – 3AF
 22D
 974B – 587C
 3ECF

You might also like