Home QBASIC C Java HTML
  • More Courses
  • MCQs
  • Blog Download
  • Tools
  • Contact

    Binary Calculation (Addition | Subtraction | Multiplication | Division)

    Posted on 2021-03-08

    A number system is a system for expressing numbers that are the mathematical notation used for manipulating other countable things. The numbers are represented in different based systems in different situations. The decimal number system is used for human counting but not role in machines. Binary numbers are used in modern digital devices. Octal and Hexadecimal number systems are just packages of 4 binary bits. In computer science, we have to study four number systems. They are

    1. Binary Number System (0, 1) / Base or radix = 2
    2. Octal Number System (0 to 7) Base or radix = 8
    3. Decimal Number System (0 to 9) Base or radix = 10
    4. Hexadecimal Number System (0 to 9 and A to F) Base or radix = 16

    The following table shows the number system equivalent to one another.

    Binary Octal Decimal Hexadecimal
    0000 0 0 0
    0001 1 1 1
    0010 2 2 2
    0011 3 3 3
    0100 4 4 4
    0101 5 5 5
    0110 6 6 6
    0111 7 7 7
    1000 10 8 8
    1001 11 9 9
    1010 12 10 A
    1011 13 11 B
    1100 14 12 C
    1101 15 13 D
    1110 16 14 E
    1111 17 15 F

    Binary Number System: Any number having a base or radix 2 and the number consists of 0 and 1 only are called binary number systems. E.g:  1110­2, 10012, 1110012

    Decimal Number System: Any number having a base or radix 8 and the number consists of 0, 1, 2, 3, 4, 5, 6, and 7 are called octal number systems. E.g: 563­8, 12358, 57368

    Decimal Number System: Any number having a base or radix 10 and the numbers consists 0, 1, 2, ........ 9 are called decimal number system. E.g : 196­10, 25810, 123610 

    Hexadecimal Number System: Any number having a base or radix 16 and the number consists 0, 1, 2, 3, ...... 9 and character consist A, B, C, D, E and F are called hexadecimal number system. Where A=10, B=11, C=13, D=14, E=15 and F=15. E.g : 25A­16, 156B16, 9D16  

    Binary Calculation

    The modern digital computer system performs every calculation in the form of binary format. They present 0 or 1, on or off, present and absent. It represents the status. 

    1) Binary Addition: 

    Binary addition is performed in a similar way to decimal addition.

    Binary Addition
    X Y X+Y
    0 0 0
    0 1 0
    1 0 0
    1 1 10 (With a carry of 1)

    Example: a) Add 110102 + 1001­2            b) 111102 + 11101­2

    Binary Addition Example

     

    2) Binary Subtraction

    Binary subtraction, a similar method is adopted as in the decimal system

    Binary Subtraction
    X Y X+Y
    0 0 0
    0 1 1 (with a borrow of 1)
    1 0 1
    1 1 0

    Example : a) 10010 - 1011          b)    1101101 - 111101

    Binary Subtraction Example

     

    3) Binary Multiplication

    Binary multiplication is easier since there is no number as a "carry" value. The following rule is adopted in binary multiplication. The values are added column-wise as in binary addition. 

    Binary Multiplication
    X Y X+Y
    0 0 0
    0 1 0
    1 0 0
    1 1 1

    Example:  a)   11101 x 111          b)    100011 x 110  

    Binary Multiplication Example

     

    4) Binary Division

    Binary Division is similar to decimal division. If a number cannot be divided, put 0 to the quotient. If a division is possible put 1 to the quotient. Multiplication and subtraction are discussed in binary multiplication and binary subtraction.  

     Example: a) Divide 1011 by 11               b)  111 by 11

    Binary Division Example


    702