Check out example codes for "c++ modulo make it give only positive numbers". It will help you in understanding the concepts better.

Code Example 1

int mod(int a, int b) {
  return (a+b)%b;
}

Learn ReactJs, React Native from akashmittal.com