Sunday, April 18, 2021

25. Write a JavaScript program check if a given positive number is a multiple of 3 or a multiple of 7.

25. Write a JavaScript program check if a given positive number is a multiple of 3 or a multiple of 7.

function test37(x) 
{
  if (x % 3 == 0 || x % 7 == 0) 
  {
    return true;
  } 
  else {
    return false;
  }
}

console.log(test37(12));
console.log(test37(14));
console.log(test37(10));
console.log(test37(11));

No comments:

14 May 2021 Current Affairs