int a = 978;
int b = 24;
int c = a - (a / b) * b;
c
seems to be remainder of division of a
and b
but I don't believe that operator %
is doing exactly the same. So what's the trick?
The %
operator does actually do exactly that. Your method is safe as long as b != 0
, but the same thing goes when using %
.