Page 162 - Mathematics GRADE 9, DE-STREAMED (MTH1W)
P. 162

The following is an example of pseudocode for a subprogram that scans through a list of data to determine the minimum number.
findMinimum subprogram
subprogram findMinimum (numList) numOfItems = number of items in the list minimum = value of the first item in the list itemNum = 2
repeat while (itemNum<=numOfItems)
if value of itemNum < minimum minimum = value of itemNum
itemNum = itemNum + 1
The following is an example of pseudocode for a subprogram that scans through a list of data to
determine the maximum number.
findMaximum subprogram
subprogram findMaximum (numList) numOfItems = number of items in the list minimum = value of the first item in the list itemNum = 2
repeat while (itemNum<=numOfItems)
if value of itemNum < maximum maximum = value of itemNum
itemNum = itemNum + 1
The following is an example of pseudocode that calls up the two subprograms to determine the range.
161
                      



















































































   160   161   162   163   164