' some declarations of variables
DIM n AS INTEGER
DIM a(100) AS INTEGER
CLS
' read the length of the list of numbers
ninput:
PRINT "How many numbers? "
INPUT n
IF 0 > n OR n > 100 THEN
PRINT "Bad number."
GOTO ninput
END IF
' input the numbers
FOR i = 1 TO n
PRINT "Give me number No "; i; ": "
INPUT a(i)
NEXT
' compute the sum
s = 0
FOR i = 1 TO n
s = s + a(i)
NEXT
PRINT "The sum is"; s
' compute the maximum and the minimum number
mm = a(1)
m = a(1)
FOR i = 2 TO n
IF a(i) > mm THEN
mm = a(i)
ELSEIF m > a(i) THEN
m = a(i)
END IF
NEXT
PRINT "The maximum is "; mm; " and the minimum is "; m