57.8k views
2 votes
Write an algorithm, using pseudocode, to input a number between 0 and 100 inclusive. The algorithm should prompt for the input and output an error message if the number is outside this range

User Aldok
by
8.3k points

1 Answer

3 votes

Final answer:

An algorithm in pseudocode to input a number between 0 and 100 inclusive, and display an error message if the number is outside this range.

Step-by-step explanation:

To input a number between 0 and 100 inclusive, you can use the following algorithm in pseudocode:

  1. Prompt the user to enter a number.
  2. Read the input number.
  3. If the number is less than 0 or greater than 100, display an error message.
  4. Otherwise, continue with the desired operations on the input number.

For example:

Prompt the user: "Enter a number between 0 and 100:"
Read the input number
If number < 0 or number > 100:
Display "Error: Number must be between 0 and 100."
Else:
Continue with desired operations
User JorenB
by
7.2k points