Task

Compute the sum and product of an array of integers.




*        Sum and product of an array  20/04/2017
SUMPROD  CSECT
         USING  SUMPROD,R15        base register
         SR     R3,R3              su=0
         LA     R5,1               pr=1
         LA     R6,1               i=1
       DO WHILE=(CH,R6,LE,=AL2((PG-A)/4))  do i=1 to hbound(a)         
         LR     R1,R6                i
         SLA    R1,2                 *4
         A      R3,A-4(R1)           su=su+a(i)
         M      R4,A-4(R1)           pr=pr*a(i)
         LA     R6,1(R6)             i++
       ENDDO    ,                  enddo i
         XDECO  R3,PG              su
         XDECO  R5,PG+12           pr
         XPRNT  PG,L'PG            print
         BR     R14                exit
A        DC     F'1',F'2',F'3',F'4',F'5',F'6',F'7',F'8',F'9',F'10'
PG       DS     CL24               buffer
         YREGS
         END    SUMPROD