Basic Theory
Code Assumption
Read more »
Addition of binary numbers is far simpler than that of decimal number. This is because, binary addition includes addition between 1 and 0 only. The addition process results into two unit: sum and carry
Initially the carry bit is set to be 0. This process is continue until all the bits in a binary number finish.
sum = a xor b xor c carry = ab + bc+ ac
Code Assumption
The following code uses 8 – bit binary unsigned integer. This means each integer can hold from 0 to 255 in decimal. So user can add up to 255. If the result is greater than 255, then condition of overflow occurs. The code contains following segments
- Decimal to Binary Conversion
- Addition of two binary numbers
- Binary to Decimal conversion
تعليقات: 0
إرسال تعليق