数制的概念与表示方法
二进制数及其运算规则
重要程度:9 分
<div>
<h2>二进制数及其运算规则</h2>
<p><strong>二进制数</strong>是一种基于2的数字系统,只包含两个数字:0和1。</p>
<ul>
<li>每个位置上的数字代表2的幂次方。</li>
<li>从右到左,幂次方依次为2^0, 2^1, 2^2, 2^3等。</li>
</ul>
<p>例如,二进制数 1011 可以转换为十进制数:</p>
<pre>
1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0
= 8 + 0 + 2 + 1
= 11 (十进制)
</pre>
<h3>二进制数的运算规则</h3>
<p>二进制数的加法、减法、乘法和除法遵循以下规则:</p>
<h4>加法规则</h4>
<table>
<tr>
<th>+</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>0</th>
<td>0</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>1</td>
<td>10 (进位)</td>
</tr>
</table>
<h4>例题</h4>
<p>计算二进制数 101 + 110:</p>
<pre>
101
+110
----
1011 (结果)
</pre>
<h4>减法规则</h4>
<table>
<tr>
<th>-</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>0</th>
<td>0</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>1</td>
<td>0 (借位)</td>
</tr>
</table>
<h4>例题</h4>
<p>计算二进制数 110 - 101:</p>
<pre>
110
-101
----
001 (结果)
</pre>
<h4>乘法规则</h4>
<table>
<tr>
<th>*</th>
<th>0</th>
<th>1</th>
</tr>
<tr>
<th>0</th>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>1</th>
<td>0</td>
<td>1</td>
</tr>
</table>
<h4>例题</h4>
<p>计算二进制数 101 * 11:</p>
<pre>
101
* 11
----
101
1010
----
1111 (结果)
</pre>
<h4>除法规则</h4>
<p>二进制数的除法可以通过长除法来实现。</p>
<h4>例题</h4>
<p>计算二进制数 1100 ÷ 11:</p>
<pre>
100
------
11 | 1100
-11
----
000
</pre>
<p>结果为 100。</p>
</div>