Ones complement Operator

Run Settings
LanguageC
Language Version
Run Command
// 2’s Complement: // Two’s complement is an operation on binary numbers. The 2’s complement of a number is equal to the complement of that number plus 1. // Example: // Bitwise complement Operation of 2 (~ 0010 ): 1101 // Calculate 2’s complement of 3: // Binary form of 3 = 0011 // 1’s Complement of 3 = 1100 // Adding 1 to 1’s complement = 1100 +1 // 2’s complement of 3 = 1101 // Note: // The bitwise Complement of 2 is same as the binary representation of -3 #include <stdio.h> // Driver code int main() { int n = 2; printf("Bitwise complement of %d : %d", n, ~n); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines