What is the output?
int main()
{
int x = 10;
int y = 20;
if (!(x^y))
printf("O");
else
printf("1");
return 0;
}
Answers
Answered by
0
The output of the given condition is 1.
- In this C++ condition we are initializing two integer variables x and y and with values 10 and 20 respectively.
- Then in the 'if' condition we are checking for the negation of x XOR y.
- If the 'if' condition is true we print O.
- Else we print 1.
- Now putting the values of x and y we get x XOR y = 30, which is true in boolean but its negation would be false thus the else part would be printed and that is 1.
Similar questions