Search

Wednesday 7 June 2017

or35

Problem:
Return true if the given non-negative number is a multiple of 3 or a multiple of 5.

Test Cases:
or35(3) → true
or35(10) → true
or35(8) → false

Solution:

public boolean or35(int n) {
  if((n%3==0) || (n%5==0))
  {
  return true;
  }
  return false;
}

No comments:

Post a Comment