What type of operator can be used to determine whether a specific relationship that exists between two values?

1 answer

Answer

1033725

2026-07-11 07:15

+ Follow

The relational operators: ==, !=, <, <=, > and >=.

p == q; // evaluates true if the value of p and q are equal, false otherwise.

p != q; // evaluates true of the value of p and q are not equal, false otherwise.

p < q; // evaluates true if the value of p is less than q, false otherwise.

p <= q; // evaluates true of the value of p is less than or equal to q, false otherwise.

p > q; // evaluates true if the value of p is greater than q, false otherwise.

p >= q; // evaluates true of the value of p is greater than or equal to q, false otherwise

Note that all of these expressions can be expressed logically in terms of the less than operator alone:

p == q is the same as NOT (p < q) AND NOT (q < p)

p != q is the same as (p < q) OR (q < p)

p < q is the same as p < q (obviously)

p <= q is the same as NOT (q < p)

p > q is the same as (q < p)

p >= q is the same as NOT (p < q)

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.