Answers for "javscript smallest number greater than or equal to N divisible by K"

0

javscript smallest number greater than or equal to N divisible by K

// Function to find the smallest number greater than or equal to N that is divisible by K
function findNum(N, K)
{
  var rem = (N + K) % K;
  if (rem == 0) return N;
  else return N + K - rem;
}
Posted by: Guest on May-13-2021

Code answers related to "javscript smallest number greater than or equal to N divisible by K"

Code answers related to "Javascript"

Browse Popular Code Answers by Language