perm filename RSUM.SIM[SIM,SYS] blob sn#460188 filedate 1979-07-20 generic text, type T, neo UTF8
OPTIONS(/E/C/-Q/-A/-I/-D);
COMMENT Procedure RSUM calculates the sum of the array A
A[1] + ... + A[N].
;
REAL PROCEDURE rsum(a,n);   ARRAY a;   INTEGER n;
BEGIN   INTEGER i;   REAL s;

    OPTIONS(/A);   s:= a[1];   a[n]:= a[n];   OPTIONS(/-A);
    FOR i:= 2 STEP 1 UNTIL n DO  s:= s + a[i];

    rsum:= s

END of rsum;