Good evening!

I am doing some homework. As part of the solution, I want to implement an algorithm that implements modulus division. I was wondering if C had an operator which does just that?

I know of the % operator, which gives you the remainder of two numbers ( 27 % 7 = 6) and that works fine 99% of the time. The only part where it fails is when I get into negative numbers. If I do - 3 % 9 in C, the answer returns -3, which makes sense as the remainder in -2. However in modulus division the answer would be 6 (modulus division considers - 3 mod 9 as -1 + (6/9), hence the answer is 6). Is there an operator that would do this sort of operation?

I know in either VB or C# you had the "mod" reserved word which would do that nicely. A similar one exist in C?

Thanks!