3 line pure C
\nint findComplement(long num) {\n    long i;\n    for(i=1;i<=num;i*=2) num^=i; \n    return num;\n}\n\nI basically check every bit of number by XOR'ing it with
```\nint findComplement(long num) {\n    long i;\n    for(i=1;i<=num;i*=2) num^=i; \n    return num;\n}\n```\nI basically check every bit of number by XOR'ing it with appropriate power of 2 which leads to its invertion.\nFor example:\n```\nEntered: 4=>100;\n100 ^ 001 = 101;\n101 ^ 010 = 111;\n111 ^ 100 = 011;\nOut:     011=>3;\n```
[]