Web Analytics

(x%2)≠0 what does this mean - i dont understand the symbols


this is the whole example - i am trying to teach my self sets :(


Example 2 − The set {1,3,5,7,9} is written as


B={x : 1≤ x <10 and (x%2)≠0} <- Means : x is 1 and less than 10

Verified Answer :

% is used in a lot of programming languages as the modulo operator.

\(a\%b=c\iff a\equiv c\mod b\)

which is to say, the remainder upon dividing \(a\) by \(b\) is \(c\).

When you divide any integer by 2, you can get either a remainder of 0 or 1. So in your example, \(x\%2 eq0\) refers to all numbers \(x\) between 1 and 9 that are not perfectly divisible by 2. In other words, \(x\%2 eq0\) refers to those \(x\) that are odd. (This assumes \(B\) is a subset of the integers.)