find 2's compliment of binary number using c++

Опубликовано: 17 Февраль 2026
на канале: it Tips
5,737
67

Source Code:
https://www.instms.com/cpp/examples/t...
In this video session we will learn about 1's and 2's complement. First of all we will discuss method to calculate complement and then will write down source code.
This process involves three arrays of characters to store binary digits.
1. Store binary input
2. Store 1's complement
3. Store 2's complement

To compute 2's complement first we have to get 1's complement. 1's complement can easily calculated by just converting 0 digit to 1 and 1 to 0 binary digit.