Download presentation
Presentation is loading. Please wait.
Published byVincent Alexander Modified over 9 years ago
1
CMP 101 Fundamentals of Computer and programming in C Rohit Khokher
2
Computer Arithmetic Every thing that can be done in decimal number system can also be done in binary number system Binary Arithmetic
3
Addition 0+0=0 0+1=1 1+0=1 1+1=0 A carry of 1 to the next higher column Like in Decimal System 9+1=0
4
Examples 101 10 111 5 2 7 10011 1001 1 0 1 0111
5
100111 11011 1 0 1 1000 1 1 0 1 1 1
6
Subtraction 0-0=0 0-1=1 1-0=1 1-1=0 A borrow from the left column 56 -29 416 -29 27 10
7
Subtraction 10101 -01110 1 2 1 0 22 1 0 00 1
8
Complementary Subtraction Complement = (base n -1) –m Where: M is the number. n denotes number of digits in m Complement of 37 10 = 10 2 -1-37=99-37 = 62 10
9
Complementary Method Find complement of subtrahend Add the minuend If there is carry of 1, add it. If no carry, then re-complement the result and negate the number.
10
Complementary Method Subtract 35 10 (subtrahend) from 18 10 (minuend) 99-56 + 92 = 1 35, 35+1 =36 Subtract 56 10 (subtrahend) from 92 10 (minuend) 99-35 + 18 = 82 99-82 = - 17 There is a carry so add it There is no carry so re- complement and negate the result
11
Complementary Method Subtract 0111000 from 10111000 0111000Subtrahend 1000111Complement +1011100Minuend 10100011Carry ?Yes 1Add it 0100100 Result
12
Complementary Method Subtract 100011 from 010010 100011Subtrahend 011100 Complement 010010 Minuend 101110 Carry ?No -010001 Re-complement Place a Negative Sign
13
Multiplications 0×00 0×10 1×00 1×11 1010 ×1001 1010 0000 0000 1010 1011010 Multiplicand Multiplier 1010 ×1001 1010 1010SS 1011010 For each 0 shift left
14
Multiplications 1111 x111 1111 1111 1111 1101001 11 1 1 1 1 1 1 Carry
15
Division 100001110 110 0 1000 110 10 1 0 110 0 1001 110 11 1 DividendDivisor Quotient Remainder Subtraction not possible quotient 0 Subtraction possible quotient 1 0101.11 Result
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.