-3
I’m doing an exercise and I can’t solve it:
The instructions are:
Write the eNumerDaSorte function which, receiving a number, tells you if it is a lucky number. Remember that the number must obey the three conditions mentioned. Your additional challenge will be: DO NOT use the if.
We can say it’s a lucky number if the number:
is positive
is a multiple of 2 or 3
is not 15
My answer was:
function eNumeroDaSorte (numero) {
return numero > 0 && 15%3==0 || 10%2==0 && numero != 15;
}
But the site is wrong with the following problems:
eNumerDaSorte is false and multiples of 2 or 3
eNumerDaSorte(7) is false
eNumerDaSorte(15) is false
Thanks for any help!
Good morning, although you have given us enough information to give us an answer, at least put a title to your question that relates to your problem. And yes, thinking about WHAT is the title of your question will make you a better programmer because it will take you to the analysis process.
– wkrueger
Okay, I appreciate the comment and I’ll try to improve on the next.
– Gerplex