Modulo restriction with negative numbers Java

59

Modulo restriction with negative numbers Java -

int mod(a, b) {
  c = a % b
  return (c < 0) ? c + b : c
}

Comments

Submit
0 Comments