二进制的加减法
1)二进制加法 (1) Binary Addition)
Since binary numbers consist of only two digits 0 and 1, so their addition is different from decimal addition. Addition of binary numbers can be done following certain rules:
由于二进制数仅由两位数字0和1组成,因此它们的加法与十进制加法不同。 可以按照某些规则添加二进制数 :
A | B | Sum | Carry |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 |
一个 | 乙 | 和 | 携带 |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1个 | 1个 | 0 |
1个 | 0 | 1个 | 0 |
1个 | 1个 | 0 | 1个 |
The above table contains two bits a and b, their sum and carry.
上表包含两个位a和b,它们的和与进位。
On adding,
在添加时,
0 + 0 = 0,
0 + 1 = 1,
1 + 0 = 1,
1 + 1 = 10 (i.e., sum is 0 and carry is 1)
Let's do some exercise and solution some questions based on binary addition to get more of the topic.
让我们做一些练习,并根据二进制加法解决一些问题,以获取更多的主题。
Example 1: Perform (10)2 + (11)2
范例1:执行(10) 2 +(11) 2
Solution:
解:
Using the rules provided above, sum operation can be performed as:
使用以上提供的规则,求和运算可以按以下方式执行:
Therefore, (10)2 + (