Skip to content

IT Essentials Lab 4: Number Systems and Arithmetic Operations

Binary Arithmetic Operations

Binary numbers use only two digits: 0 and 1. Arithmetic operations are performed using similar principles to decimal arithmetic but with a base of 2.

Binary Addition

Binary addition follows these rules:

  • 0+0=0
  • 0+1=1
  • 1+0=1
  • 1+1=0 (with a carry of 1)
  • 1+1+1=1 (with a carry of 1)

Example:

  1011 (11 in decimal)
+ 0110 (6 in decimal)
------
 10001 (17 in decimal)

Explanation:

  • Rightmost column: 1+0=1
  • Second column from right: 1+1=0 (carry-over 1)
  • Third column from right: 0+1+1 (carry-over) =0 (carry-over 1)
  • Leftmost column: 1+0+1 (carry-over) =10

Binary Subtraction

Binary subtraction also has specific rules:

  • 00=0
  • 10=1
  • 11=0
  • 01=1 (borrow 1 from the next higher bit)

Example:

  1101 (13 in decimal)
- 0110 (6 in decimal)
------
  0111 (7 in decimal)

Explanation:

  • Rightmost column: 10=1
  • Second column from right: 01=1 (borrow 1 from the third column, third column is now 0)
  • Third column from right: 01=1 (borrow 1 from the fourth column, fourth column is now 0)
  • Leftmost column: 00=0

Binary Multiplication

Binary multiplication is similar to decimal multiplication:

  • 0×0=0
  • 0×1=0
  • 1×0=0
  • 1×1=1

Example:

    101 (5 in decimal)
x   110 (6 in decimal)
--------
    000
   1010
+ 10100
--------
  11110 (30 in decimal)

Explanation:

  • First step is to mulitply 0×101=000
  • Next, multiply 1×101=1010 (In the second digit one zero, on the third we add two zeros and so on)
  • Next, mulitply 1×101=10100
  • Finally we will add the results 000+1010+10100=11110

ASCII Code

ASCII (American Standard Code for Information Interchange) is a character encoding standard for electronic communication. Each character (letters, numbers, symbols) is assigned a unique 7-bit binary code (ranging from 0 to 127).

Character ranges:

  • Digits: ASCII values from 48 -> 0 to 57 -> 9.
  • Uppercase Letters: ASCII values from 65 -> A to 90 -> Z.
  • Lowercase Letters: ASCII values from 97 -> a to 122 -> z.

Example:

  • A =65 (decimal) = 0100 0001 (binary)
  • a =97 (decimal) = 0110 0001 (binary)
  • 0 =48 (decimal) = 0011 0000 (binary)

Binary-Coded Decimal (BCD)

BCD represents each decimal digit (0-9) with a 4-bit binary code.

Example:

The decimal number 29 is represented in BCD as:

  • 2 = 0010
  • 9 = 1001

Therefore, 29 in BCD is 0010 1001.

BCD is useful for applications where decimal representation is important, such as digital displays.

DecimalBCD (4-bit Binary)
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

Practice Your Learning

1. Numbering Systems Conversion

Convert the decimal number 45 into binary, octal, and hexadecimal.Solution:
  • Binary: 45101101
  • Octal: 4555
  • Hexadecimal: 452D

2. Binary Addition

Add the binary numbers 1011 and 1101.Solution:
        1011
      + 1101
      ------
      11000 (Binary)

Decimal equivalent: 11+13=24

3. Binary Subtraction

Subtract the binary number 1101 from 10101.Solution:
       10101
    -   1101
    --------
       1000 (Binary)

Decimal equivalent: 2113=8

4. Binary Multiplication

Multiply the binary numbers 101 and 11.Solution:
        101
      ×  11
    --------
        101
    + 1010
    --------
       1111 (Binary)

Decimal equivalent: 5×3=15

5. ASCII Code

What is the ASCII code for the character "A"

Solution:

  • ASCII code for A is 65 (decimal) or 0100 0001 (binary).
Find the character corresponding to the ASCII code 97.Solution:
  • ASCII code 97 corresponds to the character a.

6. Binary-Coded Decimal (BCD)

Convert the decimal number 59 into BCD.Solution:
  • Decimal 59 in BCD: 0101 1001

7. BCD to Decimal

Convert the BCD 0110 0101 into decimal.Solution:
  • BCD 0110 0101 corresponds to decimal 65.