Question #145523

Write the pseudocode for a program that will continue prompting a user for a value whilst the total of all values remain less than 100. The program must keep track of the number of times the loop executes and display the number of times the loop executed once the loop had finished executing.

Expert's answer

BEGIN

NUMBER counter = 0, sum = 0

WHILE sum LESS THAN 100 DO

INPUT x

sum = sum + x

INCREMENT counter

ENDWHILE

PRINT counter

END


LATEST TUTORIALS
APPROVED BY CLIENTS