Question: How to create recursive loops in procedure

Suppose that n is a positive integer number and [k1,k2,...,kn] is a list of non-negative integer numbers. 

My Question: How to create the procedure proc([k1,k2,...,kn]) such that the output of this procedure is in the following form:

For i1 from 0 to k1 do

for i2 from 0 to k2 do

......................

for in from 0 to kn do

i1+i2+...+in

end do; end do;...end do;

Please Wait...