In this tutorial, you will learn how to perform addition in number systems. You will learn how to add two numbers in the Decimal, Binary, Hexadecimal, and Octal number system as well as see examples for them.

Contents:

The addition of two numbers implies incrementing the first number as many times as the second number. These are some common steps to follow while performing addition that is valid in each system.

1. Start by adding the last digits.
2. If adding two single-bit digits results in a single bit digit only in that system, no carry is generated. We proceed to the next digits in this case.
3. If the resultant is more than one digit for that system, a carry is generated and the additional carry digit is added to the left pair of digits.
4. This process is carried out till all the digits are added individually.
5. Refer to the table of each number system for finding the value of addition or add according to decimal convention and follow the different adjustments done in each system.

Decimal has ten digits varying from 0-9. All of us are familiar with decimal addition. Here is the table that shows decimal addition.

 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 5 5 6 7 8 9 10 11 12 13 14 6 6 7 8 9 10 11 12 13 14 15 7 7 8 9 10 11 12 13 14 15 16 8 8 9 10 11 12 13 14 15 16 17 9 9 10 11 12 13 14 15 16 17 18

As shown in the table,

• The digit under column i and row j corresponds to the sum of ith row and jth column.
Digitij = digitrowi + digitcolumnj. The values of i and j can vary from 0 to 9.
• All the two-digit sums have 1 as the generated carry digit.

Two decimal addition examples are shown in the following figure.

As shown in the figure,

• (58)10 + (45)10 = (103)10 (A carry of 1 is generated and gets added to the left pair of digits in both cases).
• (67)10 + (94)10 = (161)10

In the binary number system, we have just two bits, 0 and 1. There are four possible combinations of digits for addition in binary. The values of sum and carry bit are calculated for each combination. The addition of digits is done as per the shown table.

A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

As shown in the table,

• A and B are the two input digits. A carry is produced only when both the digits are one. Digits can directly be added by seeing the table.

Digits can also be added following decimal rules.

• We add digits according to the decimal convention.
• If the sum becomes > 1, the number 2 is subtracted from the sum and 1 is considered as a carry.

Here are the two examples are shown by the figure, which will make binary addition clear.

As shown in the figure,

• (1111)2 + (1010)2 In this,
1 + 0 = 1 (1 <= 1) 1 + 1 = 2 (2 > 1, so we subtract 2 from the result and consider 1 as carry) = 10 (in binary) 1 + 0 + 1 = 2 (2 > 1, same as above) = 10 1 + 1 + 1 = 3 (3 > 2, so we do 3 - 2 = 1 and 1 as carry) = 11 = (11001)2
• (1101)2 + (1110)2 In this,
1 + 0 = 1 (1 <= 1) 0 + 1 = 1 (1 <= 1) 1 + 1 = 2 (2 > 1 so we subtract 2 from it and count 1 as carry) = 10 1 + 1 + 1 = 3 (3 > 2) = 11 = (11011)2

Octal number systems have 8 possible digits from 0-7. Here is the table that shows octal addition.

Row / Column 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16

As shown in the table,

• The addition is performed per row and column. So Digitij = digitrowi + digitcolumnj, where i and j can vary from 0 to 7. Octal numbers can be directly looked up from this table and added. Also, the carry bit which is generated in adding octal numbers is shown in red.

Octal addition can be performed easily in another way by following the decimal method: –

• If the result is ≤ 7, we write down the obtained difference directly.
• If the result is > 7, then we subtract 8 from the result, write down the obtained number as the difference, and consider 1 as carry.
• For example, 6 + 7 = 13 in decimal, but 13 > 7, so 6 + 7 = 13 – 8 = 5 for octal and a carry of 1 is generated. So, 6 + 7 = (15)8 in octal which is also the value in the above table.

Here are a few examples of octal addition shown in the figure.

As shown in the figure,

• (526)8 + (721)8 In this,
6 + 1 = 7 (7 <= 7) 2 + 2 = 4 (4 <= 7) 5 + 7 = 12 (12 > 7, so 8 is subtracted from the sum, 12 – 8 = 4 and 1 is taken as carry) = 14 (in octal) = (1447)8
• (773)8 + (652)8 In this,
3 + 2 = 5 (5 <= 7) 7 + 5 = 12 (12 > 7 so we subtract 8 from it and a carry is generated) = 4 7 + 6 + 1 = 14 (14 > 7, so we subtract 8 from it, 14 – 8 = 6 with a carry of 1) = 16 (in octal) = (1645)8

The hexadecimal number system has 16 symbols in it. Addition in hexadecimal can be done according to the table shown.

 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 0 1 2 3 4 5 6 7 8 9 A B C D E F 1 1 2 3 4 5 6 7 8 9 A B C D E F 10 2 2 3 4 5 6 7 8 9 A B C D E F 10 11 3 3 4 5 6 7 8 9 A B C D E F 10 11 12 4 4 5 6 7 8 9 A B C D E F 10 11 12 13 5 5 6 7 8 9 A B C D E F 10 11 12 13 14 6 6 7 8 9 A B C D E F 10 11 12 13 14 15 7 7 8 9 A B C D E F 10 11 12 13 14 15 16 8 8 9 A B C D E F 10 11 12 13 14 15 16 17 9 9 A B C D E F 10 11 12 13 14 15 16 17 18 A A B C D E F 10 11 12 13 14 15 16 17 18 19 B B C D E F 10 11 12 13 14 15 16 17 18 19 1A C C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B D D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C E E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D F F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E

As shown in the table, the rows and columns are added together as – digitij = digitrowi + digitrcolumnj, i and j here can vary from 0 to 15(F). Whenever a carry of one is generated, it is shown by red.

Alternatively, in hexadecimal, addition can also be performed using decimal convention. To do that:

• We add the hexadecimal digits according to decimal convention. If sum ≤ 15, we substitute the corresponding hexadecimal symbol for it.
• On adding any two digits if the resultant > 15, then 16 is subtracted from it and the result is treated as the difference and a carry of 1 is added to its left pair of digits.
• For example, 7 + A = 17 in decimal addition, 17 > 16, so we subtract 16 from it, that is 17 – 16 = 1 and we have a carry of 1. So, 7 + A in hexadecimal is equal to (11)16, which is also shown in the table.

• (A78)16 + (5B2)16 In this
8 + 2 = A (10) (10 <= 15) 7 + B (11) = 18 (as 18 > 15, we subtract 16 from it 18-16 =2 and 1 is considered as carry) = 12 (in hexadecimal) A + 5 + 1 = 16 (as 16 > 15, we subtract 16 from it, 16-16 =0 and 1 is considered as carry) = 10 (in hexadecimal) = (102A)16

• (C36)16 + (89D)16 In this
6 + D = 19 (19 > 15 so we subtract 16 from it, 19 – 16 = 3 and carry of 1 is generated)
3 + 9 + 1 = D (13) (as 13 < 15)
C + 8 = 20 (as 20 > 15, we subtract 16 from it, 20 – 16 = 4 and 1 is considered as carry)
= (14D3)16

## Key Points to Remember

Here are the important points to remember in “Arithmetic Addition”.

• Addition is performed starting from the last digits.
• The addition of two n-bit numbers will at a max result in (n+1)-bit number.
• Numbers in systems can be added using tables or by decimal method and then doing adjustments according to the individual number systems.
• In addition, by the decimal method, for any sum greater than the (base-1) of that system, the base is subtracted from the sum to get resultant and a carry is generated.
• If the sum of digits becomes greater than 1, 7, 9, 15 in binary, octal, decimal, and hexadecimal number system. This carry is added to the left pair of digits.
• The actual sum which goes into the result is then calculated by subtracting 2, 8, 10, 16 respectively from the sum for binary, octal, decimal, and hexadecimal systems.

If you find any mistake above, kindly email to [email protected]