Let $x$ be an integer which can take a value of $0$ or $1$. The statement
if $(x = = 0) x = 1;$ else $x = 0;$
is equivalent to which one of the following ?
- $x = 1 + x;$
- $x = 1 - x;$
- $x = x - 1;$
- $x = 1\% x;$
My attempt :
It should be only option $(2)$ is true. but,
Can you explain little bit please, what is the value of $1\%0$ ?
AFAIK: It should be undefined, since it applied division $1/0$ which is undefined.
1%0
is undefined, see for example http://stackoverflow.com/questions/7370154/cant-mod-zero. That might be different for other programming languages. – Martin R Nov 18 '15 at 13:37