C# simple solution without using Math functions
\npublic int FindComplement(int num) {\n    int k = 1;\n    for (int i = num; i > 0; i >>= 1)\n        k <<= 1;\n    return k - num - 1;\n}\n\n\nif num = 101\nk
```\npublic int FindComplement(int num) {\n    int k = 1;\n    for (int i = num; i > 0; i >>= 1)\n        k <<= 1;\n    return k - num - 1;\n}\n```\n\nif num = 101\nk will be 1000\nk - 1 = 111\nk - num - 1 = 010\n
[]