Introduction
The Binary Number System is one of the most widely utilized numerical representation schemes in digital systems. There are just two symbols or potential digit values in the Binary System: 0 (off) and 1 (on). Any device with only two functioning states or conceivable circumstances is represented by this term.
There are two sorts of Binary numbers complement 1's complement and 2's complement. Invert the supplied integer to get the 1's complement of a binary number. The 1's complement of the binary number 110010, for example, is 001101. To acquire the 2's complement of a binary number, add 1 to the least significant bit of the provided value (LSB). For example, the binary number (110010) 2's complement is (001101) + 1 = 001110

Also Read, Binary to Hex Converter and C Static Function.
Sample Examples
Example-1 − Find 2's complement of binary number 10101100.
Invert each bit of a given binary number, which will be 01010011. Then add 1 to the LSB of this result, i.e., 01010011+1=01010100, which is the answer.
Example-2 − Find 2's complement of binary number 10011001.
Invert each bit of the given binary number, 01100110. Then add 1 to the LSB of this result, i.e., 01100110+1=01100111, which is the answer.
You can also read about dynamic array in c, Tribonacci Series and Short int in C Programming
Solution Approach
We will first find the one's complement of the binary number by just inverting the bits, i.e., 0's to 1's and vice versa. Then we will add 1 to the complementary of the binary number and finally print the output.
Steps of algorithm
- Store the binary number as a string
- Traverse the string, and if found 0, make it 1, and vice versa.
- Finally, add 1 to the string.
- Print the final output in the form of a string.