array_total.ps
%!
%total of a seria of number
/Times-Roman findfont
20 scalefont
setfont
/newline {
10 currentpoint 20 sub exch pop moveto
} def
/printN {
10 string cvs show
} def
/space {
currentpoint exch 10 add exch moveto
} def
/printNln {
printN newline
} def
/println {
show newline
} def
10 700 moveto
%create an array [1 .. 10]
1 1 10 {} for 10 array astore /Array exch store
%print array length
(length) show space /Array load length printNln
/Total 0 store
/Array load {
dup /Total load add /Total exch store
printN space /Total load printNln
} forall
newline
(Total:)show space /Total load printNln
showpage