Next: Looping and Iteration Up: Conditionals Previous: The switch statement


  1. Write a program to read two characters, and print their value when interpreted as a 2-digit hexadecimal number. Accept upper case letters for values from 10 to 15.

    " >
    (unit3:if and switch:hex)

  2. Read an integer value. Assume it is the number of a month of the year; print out the name of that month.

    " >
    (unit3:if and switch:mon)

  3. Given as input three integers representing a date as day, month, year, print out the number day, month and year for the following day's date.

    Typical input: 28 2 1992 Typical output: Date following 28:02:1992 is 29:02:1992

    " >

    (unit3:if and switch:tom)

  4. Write a program which reads two integer values. If the first is less than the second, print the message up. If the second is less than the first, print the message down If the numbers are equal, print the message equal If there is an error reading the data, print a message containing the word Error and perform exit( 0 );

    " >

    (unit3:if and switch:ude)
Fri May 20 13:40:49 BST 1994