include int main int i 4 int j 8 return 0 include int main
Solution
Here is the explanation for the first 2 problems:
#include <stdio.h>
 int main()
 {
 int i = 4;   //4 in binary = 0000 0100
 int j = 8;   //8 in binary = 0000 1000
 printf(\"%d, %d, %d\ \", i|j&j|i, i|j&&j|i, i^j);
 return 0;
 }
Here the operators used are: |, &, &&, ^.
 And the precedence is: &, ^, |, &&
 Therefore,
 i|j&j|i = i|(j&j)|i
 = i|j|i
 = (i|j)|i
 = (0100 | 1000) | (0100)
 = 1100 | 0100
 = 1100 = 4 + 8 = 12.
i|j&&j|i = (i|j)&&(j|i)
        = (0100 | 1000) && (1000 | 0100)
        = 1100 && 1100
        = 12 && 12 = 1. Here 1 holds true, and 0 holds false.
i^j = 0100 ^ 1000 = 1100 = 12.
 Therefore, the output is: 12, 1, 12.
#include <stdio.h>
 int main()
 {
 int i = 32, j = 0x20, k, l, m;   //32 in binary = 0010 0000, 0x20 in binary = 0010 0000.
   
 k = i|j;  
 l = i&j;
 m = k^l;
   
 printf(\"%d, %d, %d, %d\ \", j, k, l, m);
 return 0;
 }
 
 i|j = 0010 0000 | 0010 0000 = 0010 0000 = 32(k).
 i&j = 0010 0000 | 0010 0000 = 0010 0000 = 32(l).
 k^l = 0010 0000 ^ 0010 0000 = 0000 0000 = 0(m).
Therefore, the output is: 32, 32, 32, 0

