title | tags |
---|---|
is_divisible |
math,beginner |
Checks if the a number is divisible by another number.
Use mod()
to check if the remainder of dividing dividend
by divisor
is equal to 0
.
function is_divisible(dividend, divisor):
mod(dividend, divisor) == 0
end
is_divisible(42, 7) # true
is_divisible(13, 2) # false