Home News Contact us Blog   Get Listed

Search for C,C++,DAA Programs. Send video songs to your loved ones.

 
Custom Search
   

Shaadi.com Matrimonials

Knowledge Base
Question Bank Home
Gift your mate
Write Reviews


 

 

Important Questions: DCLD - Page 1

Page1 || Page2 || Page3 || Page4 || Page5
 

 

Binary arithmetic
Binary arithmetic is fundamental to all digital computers and most other digital systems. In particular, addition is the most important binary arithmetic process because it can be used to perform all other arithmetic operations such as subtraction, multiplication and division. Thus it is important to fully understand binary addition. Table 2-3 shows the four basic rules for binary addition.

Addition Rules

A+B

Sum

Carry

0+0

0

0

0+1

1

0

1+0

1

0

1+1

0

1

Examples of binary addition:

Decimal

Binary

5

101

+3

+ 011

8

1000


Decimal

Binary

74

1001010

+19

+ 10011

93

1011101

 Binary Subtraction
The process of binary subtraction may be viewed as the addition of a negative number. For example 9-4 may be viewed as 9 +(-4). However to determine the negative representation of a binary number, one must become familiar with 1’s and 2’s complement.

Obtaining the 1’s complement of a binary number
The 1’s complement of binary number is found by changing all the 1’s to 0s and vice versa as illustrated by the examples below:

Number

1’s Complement

10001

01110

101001

010110

Obtaining the 2’s complement of a binary number
The 2’s complement of binary number is found by adding 1 to the 1’s complement representation as illustrated by the examples below: 

Number

1’s Complement

2’s Complement

10001

01110

01111

101001

010110

010111

Subtracting using 1’s complement
For subtracting a smaller number from a larger number, the 1’s complement method is as follows:

1. Determine the 1’s complement of the smaller number.
2. Add the 1’s complement to the larger number.
3. Remove the final carry and add it to the result. This step is called the end-around carry.

Example:
11001–10011
Result from Step1: 01100
Result from Step2: 100101
Result from Step3: 00110
To verify, note that 25 - 19 = 6

For subtracting a larger number from a smaller number, the 1’s complement method is as follows:

1. Determine the 1’s complement of the larger number.
2. Add the 1’s complement to the smaller number.
3. There is no carry. The result has the opposite sign from the answer and is the 1’s complement of the answer.
4. Change the sign and take the 1’s complement of the result to get the final answer.

Example:
1001 – 1101
Result from Step1: 0010
Result from Step2: 1011
Result from Step3: -0100
To verify, note that 9 - 13 = -4

Subtracting using 2’s complement
For subtracting a smaller number from a larger number, the 2’s complement method is as follows:

1. Determine the 2’s complement of the smaller number.
2. Add the 2’s complement to the larger number.
3. Discard the final carry (there is always one in this case)

Example:
11001 – 10011
Result from Step1: 01101
Result from Step2: 100110
Result from Step3: 00110
Again, to verify, note that 25 - 19 = 6

For subtracting a larger number from a smaller number, the 2’s complement method is as follows:

1. Determine the 2’s complement of the larger number.
2. Add the 2’s complement to the smaller number.
3. There is no carry from the left-most column. The result is in 2’s complement form and is negative.
4. Change the sign and take the 2’s complement of the result to get the final answer.

Example:
1001 – 1101
Result from Step1: 0011
Result from Step2: 1100
Result from Step3: -0100
Again to verify, note that 9 - 13 = -4

Next

© copyright 2008 created by www.citysuvidha.com