algorithms.tutorialhorizon.com
Number's Complement - 2 Approaches | Algorithms
Objective: Given a number N, write a program to find a complement number of the given number. Flip all the bits of a number to get the complement of that number. Example: N = 8 Output: 7 Explanation: N = 8, binary representation: 1 0 0 0 Flip all the bits = 0 1 1 1 => 7