Check if two integers have the same sign

You can multiply them together; if they have the same sign, the result will be positive.

bool sameSign = (n1 * n2) > 0

Leave a Comment