17 % 5 is 2, the remainder of 17 divided by 5. -17 % 5 is -2 in C99 and later, because integer division truncates toward zero, not toward negative infinity. So -17 / 5 is -3, and -17 - (-3 * 5) = -17 + 15 = -2. This differs from Python, where % always returns a non-negative result. If you need Python-style modulo on negatives, you have to add n and re-mod: ((x % n) + n) % n.
Programming Fundamentals · Interview question
What does 17 % 5 give you, and what about -17 % 5?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Operators
Everything between the variables: the symbols that combine, compare, and change values. Learn the four families and the precedence rules that bite.