Q:

Write a JavaScript program to check whether two given integers are similar or not, if a given divisor divides both integers and it does not divide either

0

Write a JavaScript program to check whether two given integers are similar or not, if a given divisor divides both integers and it does not divide either.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function checking_numbers(x, y, divisor) {
  if(x % divisor === 0 && y % divisor === 0 || x % divisor !== 0 && y % divisor !==
    0) {
    return true;
  }
  return false;
}

console.log(checking_numbers(10, 25, 5))
console.log(checking_numbers(10, 20, 5))
console.log(checking_numbers(10, 20, 4))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now