Answer:

Enter age
? 16
child rate
done

In detail what happens is:

  1. The program prints "Enter age".
  2. The user enters 16.
  3. The 16 is put in AGE.
  4. The condition of the IF is tested: AGE > 16
  5. It is FALSE that 16 > 16
  6. The false branch is executed: the program prints "child rate".
  7. Execution continues with the statement after END IF: "done" is printed.

Another Way to Write the Program

There are several ways that the previous program could have been written. Here is another way:

PRINT "Enter age"
INPUT AGE
'
IF AGE <= 16 THEN
  PRINT "child rate"    ' true branch
ELSE  
  PRINT "adult rate"    ' false branch
END IF
'
END

The true branch of a two-way decision is executed with the condition part of the IF statement is true. In this new version of the program, the condition has been changed, so you must be careful about which statements are in the true branch and in the false branch.

QUESTION 10:

Check if the new version of the program works correctly: What happens if the user enters an age of 23?