0
What is a= -12%10 in C?
3 Réponses
+ 3
Plus hinanawi 's comment, if you find the left hand operand negative (e.g. -x % y or -x % -y), the result is going to be negative unless the result is 0. The sign of the right hand operand has no effect on the operation.
+ 6
Well, you can try it on code playground
0
that would be -2 my friend. "%" is the modulo operator and it returns the remainder when dividing the first number with the second. -12 / 10 = -1 with the remainder -2. (-12 = -10*1 + (-2))