what will be the output of this program will be.
i think it will be 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main(void) {
int i = 1, j = 2;
if(i > j && j > i)
i++;
if(i > j || j > i)
j++;
if(i | j)// this is valid statement or not
i++;
if(i & j)//this is valid statement or not
j++;
cout << i * j << endl;
return 0;
// if these two statement are valid, so how they work a little bit
// confused
}
Current values: 1, 2
Line 6 doesn't run.
Current values: 1, 2
Line 8 runs
Current values: 1, 3
Line 10 runs (some bits are set between them)
Current values: 2, 3
Line 12 runs (the bit pattern is 0010 & 0011; the result is 0010)
Current values 2 * 4
Line 13 prints 2 * 4 == 8