Search code examples
c++modular-arithmeticmodulo

Is there a function for integer fmod in C++?


http://en.cppreference.com/w/c/numeric/math/fmod

Alright, cool. There's this function called fmod, but it appears to only work with float, double, and long double. Is there a version of this function that works with integers in C++?


Solution

  • Yes, '%' is used for modulus operator, as Joducus said in the comment. See example.