Topper Copies

Write an algorithm to add two numbers in the octal system.

Akshit Bhardwaj, AIR 12, 2025

Step 1 : Add the two digits in the Right-most significant place

If sum $< 8$ $\rightarrow$ Write it as output bit & set carry $= 0$

If sum $\geq 8$ $\rightarrow$ Write output as Sum $- 8$ & set carry $= 1$

Step 2 : Fouth the next place compute

Sum = Carry + Digit of Number 1 + Digit of Number 2

If sum $< 8$ $\rightarrow$ Output = Sum, Carry = 0

If sum $\geq 8$ $\rightarrow$ output = Sum$-8$, Carry = 1

Step 3 : Repeat Step 2