Function mod

Function Documentation

inline int mod(const int &a, const int &n)

Computes the modulus of two integers.

This function returns the remainder of the division of a by n. The result is always non-negative, even if a is negative.

Parameters:
  • a – The dividend.

  • n – The divisor.

Returns:

int The remainder of the division of a by n.