Some questions on conditional statements

  1. What is wrong with each of the following statements?
    1. if x==4 y++;
    2. if(x=4) ++y;
    3. if (x==4) ++y else --y;

  2. Write a program which reads in two integer numbers and writes out the larger of the two.
    You may want to refer ahead to find out how to read innumbers or write them out.

Answers to these questions.


Back to the notes on conditionals.