|
|
..
|
quiz averager
Box inputNumber ofType int --latest score
Box total ofType int --total of all scores
Box numberOfScores ofType int --number of scores entered
Set numberOfScores = 0
Set total = 0
--Only giving the user one prompt
Outputln "Enter quiz scores, ending with a score of -1"
--We have 3 commands to run over and over until
-- getting our -1 as the signal to exit
Repeat
Input inputNumber
ExitOn (inputNumber == -1)
Set total = total + inputNumber
Inc numberOfScores by 1
EndRepeat
If (numberOfScores > 0) then --very important check to make
Output "The average score is "
Outputln total/numberOfScores
Else
Outputln "*** WARNING *** No quiz scores were entered!"
EndIf
|
|