Wednesday, July 18, 2007

Something to Chew On!


Dear students,


Please work in pairs to challenge yourselves and solve the following problems. Do post your answers on this blog website.

a) Look at the following algorithm. What will be the output if the following is inputted? "See me at lunchtime."

Counter = 0
input Character
WHILE (Character is not a full stop) DO
IF (Character is not a space) THEN
Counter = Counter + 1
Input Character
Endwhile
Output Character

b) Look at the following algorithm. What will be the output if the following is inputted? "See me at lunchtime."

Counter = 0
input Character
WHILE (Character is not a full stop) DO
IF (Character is not a space) THEN
Counter = Counter + 1
Input Character
Endwhile
Output Counter

c) Use the "REPEAT....UNTIL" loop to design a pseudocode to find the largest of ten numbers.