SELF
Exam
Programming
What will be the output
main()
{
int i;
i = 10;
if(i == 20 || 30)
{
printf("True");
}
else
{
printf("False");
}
}
Read Solution (Total 3)
-
- the output will be true
because if condition is having two condition with conditional operator or(||) so i==20 is false but 30 is true(any number other than 0 is true) so it will print true. - 10 years agoHelpfull: Yes(2) No(0)
- if condition is not true..so it will give false..
- 10 years agoHelpfull: Yes(0) No(0)
- The output is true because there are two coditions in if it is nothing but
if(cond 1 || cond 2){}
In our case condition1 fails but condition 2 is 30 it will treat that number as true.So the output is true
the output wil be false only if condition1 is i==10 or condition 2 is 0 - 4 years agoHelpfull: Yes(0) No(0)
SELF Other Question