num%2==1
The modulo operator (%) divides the left hand side by the right hand side and returns the remainder. When dividing an odd number by 2 there will always be a remainder of 1.
9.5m questions
12.2m answers