Determine how many times the innermost loop will be iterated when the algorithm segment is implemented and run. (Assume that m and n are positive integers.)
for j := 1 to m
for k := 1 to n
[Statements in body of inner loop.
None contain branching statements that
lead outside the loop.]
next k
next j
Discrete mathematics



Answer :

The inner loop iterates 'n' times, outer loop iterates 'm' times and total loop iterates (m×n) times.

Given program,

for j = 1 to m

   k = 1 to n

statement in the body of innerloop. None contain branching statements that lead outside the loop.

next j

next k

Here, in the inner loop k iterates from 1 to n that is n times and j iterates from 1 to m that is m times.

Finally, the whole loop iterates m×n times because for every value of j from 1 to m, k value increases from 1 to n.

So, the inner loop iterates 'n' times, outer loop iterates 'm' times and total loop iterates (m×n) times.

To know more about Iterations refer to:

http://brainly.com/question/28134937

#SPJ4