Practice
LoopsCoreIGCSE 0478

Validate a menu choice

REPEAT UNTIL practice: keep reading a menu choice until the value is between 1 and 4.

A menu accepts only the numbers 1, 2, 3, or 4.

Write pseudocode that keeps asking for a choice until the user enters a valid number, then outputs Accepted.

Your program should

  • Use REPEAT ... UNTIL.
  • The prompt must run at least once.
  • Stop only when the choice is between 1 and 4 inclusive.
  • Output Accepted after a valid choice.

Sample input

8
0
3

Sample output

Accepted

Starter

Pseudocode
// Keep reading Choice until it is between 1 and 4, then output Accepted.
DECLARE Choice : INTEGER