First loop, loops through array a in increments of 1 until index m is greater than or equal to 5:
a[1], a[2], a[3], a[4], a[5]
Second loop, loops through array a in increments of 2 until index k is greater than or equal to 5:
a[1], a[3], a[5]
Third loop, loops through array b in increments of 1 starting at 3 until index j is greater than or equal to 10:
b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10]
Fourth loop, loops through array b in increments of 3 starting at 3 until index k is greater than or equal to 12:
b[3], b[6], b[9], b[12]
Fifth loop, loops through array c in increments of 2 starting at 2 until index i is greater than or equal to 11:
c[2], c[4], c[6], c[8], c[10]
2007-05-05 10:28:15
·
answer #1
·
answered by hockeyf4n 2
·
0⤊
0⤋
Let me try to make this straighforward
for (m=1 ; m<=5; m++)
cout<
Ans: This sequentially iterates through array "a" from index 1 to index 5
for (k=1; k<=5; k+2)
cout<
Ans: This will indefinitely print item a[1] forever. The program will never end because the value of k is always 1. the k+2 just adds the value but never reassigns the value of k.
for (j=3; j<=10; j++)
cout<
Ans: This iterates sequentially through array "b" from index 3 to index 10
for (k=3; k<=12; k+3)
cout<
Ans: This will indefinitely print the value in b[3].
for (i=2; i<11; i=i+2)
cout<
Ans: This iterates through array "c" printing every other element starting from 2 index and ending with 11 index
2007-05-13 07:42:18
·
answer #2
·
answered by ? 2
·
0⤊
0⤋
for (k=1; k<=5; k+2)
/* add 2 to k but discard the result (didn't store the result anywhere). You want k+=2; or k = k+2; */
cout<
Same with k+3; and i + 2;
2007-05-05 16:49:10
·
answer #3
·
answered by bitwiseoperator2002 6
·
1⤊
0⤋