The opposite of the modulo operator?

In OpenOffice CALC there is QUOTIENT, which returns the integer part of a division ᎓

      MOD(17;4) returns 1, while
 QUOTIENT(17;4) returns 4.

      MOD(33;9) returns 6, while
 QUOTIENT(33;9) returns 3.

I've always thought of QUOTIENT as MOD's counterpart  —  perhaps this is what the OP meant by "opposite" of MOD.


What you are looking for is called integer division. It is not related to the modulo operator at all.

To perform an integer division, simply ensure that neither operand is a float/double.

Example:

int one = 81 / 80;

This gives you 1 while double notOne = 81.0 / 80 would give you 1.0125 for example.


You already got the answer, no need to deal with the decimals if you assign it to an integer.

In your comment you say that you are working with decimals, then Math.Floor is a possibility. ie:

double d = Math.Floor(81.0 / 80.0); // 1.0000....