An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true.
My solution follow
The simplest way (IMO) that is not confusing and easy to read:
// Three booleans, check if two or more are true return ( a && ( b || c ) ) || ( b && c );