What will be the output? #include
int main()
{
if((0&&1)||(1&&-1))
printf ("condition is true ");
else
printf (" condition is false ");
return 0;
}
a)condition is true
b)condition is false
c) error
d)no output possible
Answers
Answered by
3
Logical AND && operator:
If both of the operand's values is non-zero (true) else it returns 0 (false).
0&&1 Output is 0
1&&-1 Output is 1
Logical OR || operator:
If any of the operand's values is non-zero (true),it returns 1 ("true"), it returns 0 ("false") if all operand's values are 0 (false).
0 || 1 Output is 1
1 is true
Answer:
condition is true
Answered by
0
Option a)condition is true:
Explanation:
- The above code holds the logical (||) and (&&)condition, in which the (&&) condition states true if both conditions will be true. The (||) condition states true is any of the conditions is true.
- The 0 states false but the 1 and -1 states true, It is because any number is written in the if statement except 0 will result as true.
- The above if condition will gives the result (false&&True)||(True&&True). the second condition is true hence the result gives the true and the program prints the result "condition is true".
- So the option a is the correct while the other is not because the other is not match with the output.
Learn More:
- Logical (&&) and (||) operator : https://brainly.in/question/10874212
Similar questions