Task

Create a function that returns the maximum value in a provided set of values,

where the number of values may not be known until run-time.




10 INPUT "How many items? ", N%
20 DIM ARR(N%)
30 FOR I% = 0 TO N%-1
40 PRINT "Value of item #";I%
50 INPUT ARR(I%)
60 NEXT I%
70 CHAMP = ARR(0) : INDEX = 0
80 FOR I% = 1 TO N%-1
90 IF ARR(I%)>CHAMP THEN CHAMP=ARR(I%):INDEX=I%
100 NEXT I%
110 PRINT "The maximum value was ";CHAMP;" at index ";INDEX;"."
120 END