What is the value of $1\%0$?

268 Views Asked by At

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 ?

  1. $x = 1 + x;$
  2. $x = 1 - x;$
  3. $x = x - 1;$
  4. $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

There are 1 best solutions below

6
On BEST ANSWER

"$1\%0$" would be equivalent to $1-\Big\lfloor\frac10\Big\rfloor\times0$.

Modulo by $0$ is as meaningless as Division by $0$.