Question #91462
What is the value of k after the following code has been executed?
k := 0
for i1 := 1 to n1
for i2 := 1 to n2
.
.
.
for im := 1 to nm
k := k + 1
1
Expert's answer
2019-07-08T10:25:27-0400

The value of k would be k=i1=1n1i2=1n2...im=1nm1k=\sum\limits_{i_1=1}^{n_1} \sum\limits_{i_2=1}^{n_2}...\sum\limits_{i_m=1}^{n_m}1 =i1=1n1i2=1n2...im1=1nm1nm\sum\limits_{i_1=1}^{n_1} \sum\limits_{i_2=1}^{n_2}...\sum\limits_{i_{m-1}=1}^{n_{m-1}}n_m =i1=1n1i2=1n2...im2=1nm2nmnm1=\sum\limits_{i_1=1}^{n_1} \sum\limits_{i_2=1}^{n_2}...\sum\limits_{i_{m-2}=1}^{n_{m-2}}n_m \cdot n_{m-1}==...=i=1mni=...=\prod\limits_{i=1}^{m}n_i


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS