# Daily Challenge #157 - Is N Divisible by X and Y?

### dev.to staff ・1 min read

Create a function `isDivisible(n, x, y)`

that checks if a number `n`

is divisible by two numbers `x`

AND `y`

. All inputs are positive, non-zero digits.

*Example*:

`is_divisible(3,1,3)--> True because 3 is divisible by 1 and 3`

`is_divisible(12,2,6)--> True because 12 is divisible by 2 and 6`

`is_divisible(100,5,3)--> False because 100 is not divisible by 3`

`is_divisible(12,7,5)--> False because 12 is neither divisible by 7 nor 5`

*This challenge comes from naaz on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!*

*Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!*

Ruby

This was another one for GolfScript:

I'm not happy with the number of stack manipulations, but I didn't manage to make it work with fewer.

Usage (1 == true and 0 == false):

Trick question. In the instructions, it says to make a function called isDivisible() but in the example, it uses is_divisible() 🤔

PHP:

JavaScript

ruby

HaskellTest.

## Racket

Thank you! im working on everything right now!