in c++ how do you check if a number is odd or even?
thanks
in c++ how do you check if a number is odd or even?
thanks
num % 2
There is a FAQ entry with just that title. You may find that, and other useful stuff here:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
thanks !!
how do i check if a number is not divisible by 2?
not divisible by 2 == odd.
Or you could read what % does.
Or ... and so on.