Vidyalelo
C Programming · Q46

Operators and Expressions

Programming · C Programming · question 46

Q46

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);

A.
11
B.
12
C.
13
Answer
D.
14
E.
Compilation error

Answer: Option C

Solution

Answer: Option C
Solution:
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