77.2k views
0 votes
If num is an int which expression always evaluates to true if num holds an odd number

1) Num%2==0
2)Num%2 <0
3)Num%2==1
4)Num/2==1

1 Answer

5 votes

The answer is 2) Num%2==1.
The modulus operator (%) divides the left hand side by the right hand side and returns the remainder.

Examples:
3%2=1 : 2 goes into 3 once, with 1 remaining.

5%2 =1 : 2 goes into 5 twice, with 1 remaining.

11%2 =1 : 2 goes into 11 five times, with 1 remaining.

User Jpgerb
by
7.3k points