Expression x % y is equivalent to____?
Answer: B
Correct answer: (x – (x/y) * y)
The standard guarantees that integer division and remainder satisfy
\[ (x / y) \times y + (x \% y) = x \]Rearranging gives \(x \% y = x - (x / y) \times y\). The multiplication by \(y\) is essential - it is what converts the quotient back into the part of \(x\) that divides exactly.
Please log in or register to report this question.