Write an expression that evaluates to true if the integer variable x contains an even value , and false if it contains an odd value .

LANGUAGE: C++

CHALLENGE:

Write an expression  that evaluates  to true  if the integer  variable  x contains an even value , and false  if it contains an odd value.

SOLUTION:

The Bad News: The content you are trying to access is only available to members.

The Good News: You too can be a member, simply Click Here.

Already a member?

Posted in ,

2 Comments

  1. Gregory on April 3, 2016 at 2:53 pm

    Matthew can you break this down. I don’t understand the answer.

  2. Kevin on October 24, 2016 at 3:38 pm

    Probly too late but may be others, the % operator finds the remainder of division, so if an even number is divided by 2 the remainder will be 0 and if it’s odd it will not.

Leave a Comment

You must be logged in to post a comment.