Discussion :: Operators and Expressions
-
Find the output of the following program.
#include
void main()
{
int y=10;
if(y++>9 && y++!=10 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
Answer : Option C
Explanation :
All the three condition in if is true.
if(y++>9 && y++!=10 && y++>11) such as
1st condition : 10++ > 9 is true and value of y is increase by 1 i.e y =11
2nd condition : 11++ != 10 is also ture and value of y is increase by 1 i.e y =12
3rd condition : 12++ > 11 is also ture and value of y is increase by 1 i.e y =13
Therefore if is excuted and print the value of y = 13
Be The First To Comment