Skip to content
ExamHope Logo

examhope

Primary Menu
  • Digital Logic
    • Arithmetic Operations
    • Asynchronous/Ripple Counters
    • Basic Gates
    • Boolean Algebraic Theorems
    • Codes
  • Data Structures
    • Binary Heaps
    • Binary Search
    • Binary Search Trees
    • Binary Tree
    • Binary Tree Sort
    • Bipartite Graphs
    • Complete Graph
  • Theory of Computation
    • Finite Automata
    • Finite Automaton First Example
  • Current Affairs
    • Sports News
    • Tech News
    • Bollywood News
    • Daily News
  • Database
  • Computer Network
  • Computer Organization and Architecture
  • C Language
  • Operating Systems
  • Software Engineering
  • Theory of Computation
  • About us
  • Contact Us
  • Privacy Policy
  • DMCA Policy
  • Terms and Conditions
  • Home
  • IT
  • Computer Organization and Architecture
  • Integer Addition and Subtraction– Computer Arithmetic
  • Computer Arithmetic
  • Computer Organization and Architecture

Integer Addition and Subtraction– Computer Arithmetic

examhopeinfo@gmail.com November 10, 2025 3 minutes read
Integer Addition and Subtraction

Integer Addition and Subtraction

💡 Data Representation – Computer Arithmetic (Integer Addition and Subtraction)

When we do math in our head, adding or subtracting numbers feels natural.
But inside a computer, things are different.
A computer doesn’t “see” numbers the way we do — it only understands 0s and 1s.

So, how does a machine add or subtract numbers using just these two digits?
Let’s find out.


🧮 1. How Computers Represent Integers

Before a computer can add or subtract, it first needs to represent numbers in binary (base 2).
For example:

  • Decimal 5 → Binary 0101
  • Decimal 3 → Binary 0011

But what about negative numbers like -5?
That’s where signed number representations come in — such as:

  • Sign-Magnitude
  • 1’s Complement
  • 2’s Complement

Among these, 2’s Complement is the one computers use most often because it makes addition and subtraction super simple.
We’ll mainly use that here.


🔹 2. Binary Addition

Adding binary numbers works almost exactly like decimal addition — just simpler, because you only have 0s and 1s.

Here are the basic rules:

Binary AdditionResult
0 + 00
0 + 11
1 + 01
1 + 10 (and carry 1)

So, if we add 1 + 1, we write 0 and carry 1 to the next column — just like in normal math when 9 + 1 = 10.


🧠 Example 1: Simple Binary Addition

Let’s add 0101 (+5) and 0011 (+3).

   0101
+  0011
--------
   1000

Answer = 1000 (which is 8 in decimal)
✅ So, 5 + 3 = 8. Works perfectly!


⚠️ Overflow in Binary Addition

When adding signed numbers, if the result is too big to fit in the number of bits available, we get overflow.

For example (with 4-bit numbers):

   0111 (+7)
+  0001 (+1)
------------
   1000 (-8 in 2’s complement)

That looks wrong, right? It’s because the 5th bit (carry) overflowed — our 4-bit system can’t represent +8.
So, overflow means the result is outside the representable range.


🔹 3. Binary Subtraction

Now, subtraction.
You might think computers have a special “subtract” circuit — but actually, they don’t need one!
They perform subtraction using addition.

How?
By adding the 2’s complement of the number you want to subtract.

Let’s see what that means.


✳️ Rule:

A - B = A + (2’s complement of B)

So instead of subtracting directly, the computer flips all the bits of B, adds 1, and then adds that to A.


🧠 Example 2: Subtracting Positive Numbers

Let’s calculate 5 – 3 using 4-bit binary.

  1. Write 5 → 0101
  2. Write 3 → 0011
  3. Find 2’s complement of 3:
  • Invert bits: 1100
  • Add 1: 1101
  1. Now add 5 and 2’s complement of 3:
   0101
+  1101
--------
  10010

We only keep the last 4 bits → 0010
✅ Result = 2 → correct!


🧠 Example 3: Subtracting a Larger Number (Negative Result)

Let’s try 3 – 5 using 4 bits.

  1. 3 → 0011
  2. 5 → 0101
  3. Find 2’s complement of 5:
  • Invert bits: 1010
  • Add 1: 1011
  1. Add 3 and 2’s complement of 5:
   0011
+  1011
--------
  1110

1110 in 2’s complement represents -2.
✅ So, 3 – 5 = -2. Perfect again!


🧩 4. Diagram: Integer Addition and Subtraction in Computers

Here’s a simple block diagram showing how the computer performs these operations:

          +--------------------------------------+
          |            Arithmetic Logic Unit     |
          |                  (ALU)               |
          +------------------+-------------------+
                             |
           +-----------------+-----------------+
           |                                   |
           v                                   v
   +---------------+                 +-----------------+
   |   Operand A   |                 |   Operand B     |
   +---------------+                 +-----------------+
             |                               |
             |                               v
             |                  +---------------------------+
             |                  |  2’s Complement Circuit   |
             |                  | (used when subtracting)   |
             |                  +-----------+---------------+
             |                              |
             +------------------------------+
                            |
                            v
                   +-----------------+
                   | Binary Adder    |
                   +-----------------+
                            |
                            v
                     +---------------+
                     |   Result      |
                     +---------------+

⚖️ 5. Summary of Binary Arithmetic Rules

OperationMethodExample (4-bit)Result
AdditionAdd normally0101 + 00111000 (+8)
SubtractionAdd 2’s complement of subtrahend0101 – 00110010 (+2)
Negative resultComes automatically in 2’s complement0011 – 01011110 (-2)
OverflowOccurs when sign bit changes unexpectedly0111 + 0001Overflow!

About the Author

examhopeinfo@gmail.com

Administrator

Visit Website View All Posts

Post navigation

Previous: Fixed and Floating Point Representations — Data Representation
Next: Ripple Carry Adder — Computer Arithmetic

Related News

Cache Coherency — Parallel Processors
  • Cache Coherency
  • Computer Organization and Architecture

Cache Coherency — Parallel Processors

examhopeinfo@gmail.com November 11, 2025 0
Shared Memory Multiprocessors
  • Shared Memory Multiprocessors
  • Computer Organization and Architecture

Shared Memory Multiprocessors — Parallel Processors

examhopeinfo@gmail.com November 11, 2025 0
parallel processors
  • parallel processors
  • Computer Organization and Architecture

Introduction to parallel processors

examhopeinfo@gmail.com November 11, 2025 0

Recent Posts

  • Vivo X200: जाने कितनी कम कीमत पर मिल रहा ये 9400 मिडिया टेक प्रोसेसर वाला स्मार्टफोन
  • Samsung Galaxy S25 Plus पर मिल रही भारी छूट ,जाने सेल प्राइस
  • AI के इस ज़माने में कैसे बिजली बचा रहे हैं यह स्मार्ट प्लग?
  • क्या है यह GhostPairing Scam और बिना पासवर्ड और सिम के क्यों हो रहा है व्हाट्सप्प अकाउंट हैक
  • Leica कैमरे के साथ जल्द लॉन्च हो सकता है Xiaomi Ultra 17

At ExamHope, we understand that preparing for exams can be challenging, overwhelming, and sometimes stressful. That’s why we are dedicated to providing high-quality educational resources, tips, and guidance to help students and aspirants achieve their goals with confidence. Whether you are preparing for competitive exams, school tests, or professional certifications, ExamHope is here to make your learning journey smarter, easier, and more effective.

Quick links

  • About us
  • Contact Us
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • DMCA Policy

Category

  • Computer Network
  • Computer Organization and Architecture
  • Data Structures
  • C Language
  • Theory of Computation
  • Database

You may have missed

Vivo X200 Price Drop
  • IT
  • Current Affairs
  • Tech News

Vivo X200: जाने कितनी कम कीमत पर मिल रहा ये 9400 मिडिया टेक प्रोसेसर वाला स्मार्टफोन

examhopeinfo@gmail.com December 23, 2025 0
Samsung Galaxy S25 Plus
  • IT
  • Current Affairs
  • Tech News

Samsung Galaxy S25 Plus पर मिल रही भारी छूट ,जाने सेल प्राइस

examhopeinfo@gmail.com December 22, 2025 0
Electricity bill saving Smart Plug
  • IT
  • Current Affairs
  • Tech News

AI के इस ज़माने में कैसे बिजली बचा रहे हैं यह स्मार्ट प्लग?

examhopeinfo@gmail.com December 21, 2025 0
Ghost Pairing Scam on Whatsapp
  • IT
  • Current Affairs
  • Tech News

क्या है यह GhostPairing Scam और बिना पासवर्ड और सिम के क्यों हो रहा है व्हाट्सप्प अकाउंट हैक

examhopeinfo@gmail.com December 21, 2025 0
Copyright © All rights reserved for ExamHope. | MoreNews by AF themes.