← Unit 2 · all exercises
Saved in this browser only

Does it divide evenly

Return true when the first number divides evenly by the second, leaving no remainder.

boolean divides(int n, int by)

Solution.java
Loading editor…
Results

Examples

  • divides(10, 5) → true
  • divides(10, 3) → false

There are also 3 hidden tests you can't see. Solve the problem, not the examples.