Determine how many times the inner loop will be iterated when the following algorithm is implemented and run:
For i=1 to 4
For j=1 to i
Next j
Next i
Answers
Answered by
0
Answer:
first line : it depends whether if it's equal or inferior to 4 : in this case the iteration will be repeated 4 time .
in the second line: j gonna be repeated i time , so for i=n ,j gonna be repeated fact(i) time
the internal loop will be repeated 10 time
Explanation:
1 - for i= 1 , j gonna be repeated 1 time
2-for i= 2 , j gonna be repeated 2 time
3-for i= 3 , j gonna be repeated 3 time
4-for i= 4 , j gonna be repeated 4 time
Similar questions