Tuesday, August 9, 2011

Chapter 4, exercise 6

6.  Rewrite the following nested if statements using a single if statement and logical operators.


if (x<1)
  if (x>10)
    statement;

if ( x<1 && x>10 )
  statement;

Note that this condition could never be true.

No comments:

Post a Comment