asked 128k views
3 votes
Write a pseudocode algorithm using a FOR loop to read five lowercase letters and output the largest and smallest. (a is less than b).

asked
User Fjott
by
7.8k points

1 Answer

3 votes
1. Set "smallest" to the largest lowercase letter, such as "z".
2. Set "largest" to the smallest lowercase letter, such as "a".
3. For "i" from 1 to 5 (inclusive):
a. Prompt the user to enter a lowercase letter.
b. Read the user's input into a variable "letter".
c. If "letter" is less than "smallest":
i. Set "smallest" to "letter".
d. If "letter" is greater than "largest":
i. Set "largest" to "letter".
4. Output "The smallest letter is: " + smallest.
5. Output "The largest letter is: " + largest.
answered
User Swaleh Matongwa
by
8.1k points