2,145 views

1 Answer

Best answer
8 8 votes

x should be equal to 13.
when i=0; x++ and if would not get executed.
when i=1; x++ gets executed, but value of x would increment after that statement so the if would not get evaluated.
So,
i=0 x=0
i=1 x=1
i=3 x=4
i=5 x=7
i=7 x=10
i=9 x=13
when i is even i%2 is false.
x=13 is the answer.

• selected by
Position:
Show:

No related questions found