Explanation of Bitwise NOT Operator
See two’s complement for the representation of negative integers in many languages. As you can see, -2 is represented by 1111110; if you invert all those bits you get 0000001, i.e. a value of 1.
See two’s complement for the representation of negative integers in many languages. As you can see, -2 is represented by 1111110; if you invert all those bits you get 0000001, i.e. a value of 1.
#include <stdio.h> int main(void) { int a, b, result; printf(“Enter the numbers to be multiplied:”); scanf(“%d%d”, &a, &b); // a > b result = 0; while (b != 0) // Iterate the loop till b == 0 { if (b & 1) // Bitwise & of the value of b with 1 { result = … Read more