Find the output of the following program.
#include<stdio.h>
void main()
{
int y=10;
if(y++>9 && y++!=11 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
#include<stdio.h>
void main()
{
int y=10;
if(y++>9 && y++!=11 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
A. 11
B. 12
C. 13
D. 14
E. Compilation error
Answer: Option B
Solution(By Examveda Team)
Since the second condition is false so, further conditions will not be checked, it will be skipped.
Join The Discussion
Comments ( 4 )
Related Questions on Operators and Expressions
What does the ++ operator do in C when applied to a variable?
A. Decrements by 1
B. Adds 1
C. Doubles the value
D. Leaves it unchanged
Y=10;
(Y++>9)
(10++>9)
Y=11
So , second condition is false y=11
How?
Answer should be 11
how this happens