Test cases:
Test cases | Expected | Result |
---|---|---|
or35(15) | true | OK |
or35(8) | false | OK |
or35(12) | true | OK |
Java solution:
public class Program4 {
public static void main(String[] args) {
Program4.or35(15);
Program4.or35(8);
Program4.or35(12);
}
public static boolean or35(int n) {
if (n % 3 == 0 || n % 5 == 0) {
return true;
}
return false;
}
}
Javascript solution:
const or35 = (num) => {
if (num % 3 === 0 || num % 5 === 0) {
return true;
}
return false;
}
console.log(or35(15)); //true
console.log(or35(8)); //false
console.log(or35(12)); //true