DIM n AS INTEGER
DIM a(100) AS SINGLE
CLS
PRINT "Give me the numbers. Finish with 0."
' input the numbers
i = 0
readanumber:
i = i + 1
PRINT "Give me number No "; i; ": "
INPUT a(i)
IF a(i) = 0 THEN
n = i - 1
ELSE
IF i < 100 THEN
GOTO readanumber
ELSE
PRINT "Cannot read any more. Bye."
END IF
END IF
' 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