+ 1
A small doubt in Java ❤️ [Solved]
Is "N%2!=0" means odd numbers and "N%2==0" means even numbers? Could you explain this please 🙏
4 Respostas
+ 2
It's about what is remaining when divided by 2
So "N"%2!=0 means
Whatever number "N" is let's say its 5 if I divide this by 2 im left with remainder 1 which does not equal zero so it has to be an odd number which will return true, it's TRUE that it does not equal 0
Its like having to share 5 coins in real life between 2 people, 2 of those people will have 2 coins and you have the remainder 1
+ 2
Yes. Because odd number is not divisible by 2. And even number is.
+ 2
Gl̸̗͓̘̽͂̏̋̽̕ị̶̢̈̔t̴̨̲̫̏̈́̋̈͜ͅc̸̙̬͇̒̋͛h̸̥̯̱̽ thanks bro ❤️, what kind of programmer are you? It seems like you're an ethical hacker....
+ 1
Any Numbers which you divided by 2 and get the remainder is not equal to 0 is called odd number.eg : 7/2 then its remainder is 1 .
Any Numbers which you divided by 2 and get the remainder is equal to 0 is called even number.eg : 4/2 then its remainder is 0 .