#COMPILE EXE "s26_array_math.exe"
' Sample: Array math - sum, average, min, max
FUNCTION PBMAIN() AS LONG
    DIM arr(5) AS LONG, i AS LONG, total AS LONG, mn AS LONG, mx AS LONG
    arr(0)=45: arr(1)=12: arr(2)=78: arr(3)=34: arr(4)=56: arr(5)=23
    total = 0: mn = arr(0): mx = arr(0)
    FOR i = 0 TO 5
        total = total + arr(i)
        IF arr(i) < mn THEN mn = arr(i)
        IF arr(i) > mx THEN mx = arr(i)
    NEXT i
    PRINT "Sum ="; total
    PRINT "Average ="; total / 6
    PRINT "Min ="; mn
    PRINT "Max ="; mx
    FUNCTION = 0
END FUNCTION
