SHS
GRADE
11
COMPUTER PROGRAMMING .NET 1
QUARTER 1- MODULE 4
Use Mathematical Concepts and
Techniques
Name: _______________________________________________________________________
Grade Level & Section: __________________________________________________________
Subject Teacher: _______________________________________________________________
OBJECTIVES:
After this lesson, you will be able to answer the following question:
How to perform Binary Arithmetic operations
LESSON PROPER
Binary Addition
Rules for Binary
Just like adding decimal numbers, you have to align the addends. Addition:
Then, start adding the bits from right to left. When the sum in one
column is two-bits (two digits in decimal), the least significant is written 0+0=0
as a part of the total sum and the most significant figure is carried to 0+1=1
the left adjacent column.
1+0=1
1+1=10 (0, Carry 1)
Example
STEPS
Step 1: 0+1=1
Step 2: 1+1=0, carry 1 to the left adjacent column then
Step 3: We will start from the carry. 1+0=1 then, 1+1=0, carry 1
Step 4: We will start from the carry. 1+1=0, carry 1 then, 0+1=1
Step 5: We will start from the carry. 1+1=0, carry 1
Step 6: We will start from the carry. 1+1=0, carry 1
Step 7: Bring down the carry which is 1. 2
Note: Do not forget to put the base (2).
Rules for Binary
Binary Subtraction
Subtraction:
Binary subtraction is like subtraction in decimal. But in the last rule, it
0-0=0
may be new to you. In binary, it is 10 is not read as “ten” it is “one,
zero” or “two”. Remember that if you are subtracting 1 from 0 you 1-0=1
need to borrow from its next column. 1-1=0
0-1=cannot be
10-1=1 (Borrow 1 from
the left adjacent column)
1
Example
Step 1: 1-0=1
Step 2: 0-1=1 (borrow 1 bit from the left adjacent column to make it 10)
Step 3: 1-0=1
Step 4: 10-1=1 (borrow 1 bit from the left adjacent column to make it 10)
Step 5: 0-0=0
Note: 10 is equal to 2 that is why 10-1=1.
Binary Multiplication
In binary multiplication, it has only 3 rules, (0x0=0, 0x1=0 and 1×1=1). Just as in decimal, any digit
that is multiplied by 1, the answer is the number itself and any number that is multiplied by 0, the
answer is 0.
Step 1: 11011011×1=11011011
Step 2: 11011011×0=00000000
Step 3: 11011011×1=11011011
Step 4: After getting the product of each digits, you will now get the sum of all the products.
Step 5: Bring down 1.
Step 6: 1+0=1
Step 7: 0+0+1=1
Step 8: 1+0+1=0, carry 1
Step 9: 1+1=0, carry 1, 0+0=0
Step 10: 1+0+0+1=0, carry 1
Step 11: 1+1=0, carry 1, 0+0=0, 0+1=1
Step 12: 1+1=0, carry 1, 0+0+0=0
Step 13: 1+0+1=0, carry 1
Step 14: 1+1=0, Carry 1
Step 15: Bring down 1
2
Binary Division
Compare the divisor to the first bit in the dividend, if the divisor is bigger than the dividend then,
add another one bit until the divisor is lesser than the dividend.
Step 1:101>1, add another 1-bit
Step 2: 101>11, Add again another 1-bit
Step 3: 101<111, get the quotient of this term.
Step 4: Since 101 goes into 111 we will put 1 in the quotient above.
Step 5: It can only go once that is why we have 1 above.
Step 6: Then, multiply: 101×1=101 (recall the binary multiplication process).
Step 7: Whatever will be the product you will subtract it to the dividend. Just like in the example.
Step 8: Bring down the next bit which is 0 to make it 100.
Step 9: Just repeat the process above until you finish the problem.
Finally, we have now the quotient for 11100110/101. 101110 base 2.
3
ACTIVITIES
I Perform Binary Addition.
A B C
1111 1011 11011
+ 1001 + 1101 + 11101
D E
101101 101111
+ 110011 + 111011
II Perform Binary Subtraction
A B C
1111 11011 111011
-1001 - 1101 -11101
D E
101111 101111
- 1011 - 11011
4
III Perform Binary Multiplication
A B C
11011 101111 1011
x 101 x 111 x 1101
IV Perform Binary Division
A B
10 11000 10 10100
REFERENCES:
Innovative Training Works, Inc. (2016) Computer Programming Vol. 1, Rex Bookstore Inc. Rex
Publishing Inc.