Q:

Write a JavaScript program to check whether two numbers are in range 40..60 or in the range 70..100 inclusive

0

Write a JavaScript program to check whether two numbers are in range 40..60 or in the range 70..100 inclusive.

All Answers

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

function numbers_ranges(x, y) {
  if ((x >= 40 && x <= 60 && y >= 40 && y <= 60) 
      || 
      (x >= 70 && x <= 100 && y >= 70 && y <= 100))
     {
    return true;
     } 
    else 
     {
    return false;
  }
}

console.log(numbers_ranges(44, 56));
console.log(numbers_ranges(70, 95));
console.log(numbers_ranges(50, 89));

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