I changed this:
into this:
In the first loop I get 18, then in the second I get 12. The goal is to get the same result. I need to keep it a nested loop. What's wrong?[edit]Added VB tags[/edit]
Visual Basic:
intTotal = 0
For intOuterCounter = 2 To 5 Step 2
For intInnerCounter = 2 To 4
intTotal += intInnerCounter
Next intInnerCounter
Next intOuterCounter
into this:
Visual Basic:
intTotal = 0
intInnerCounter = 2
intOuterCounter = 2
Do While (intOuterCounter >= 2 And intOuterCounter <= 5)
intOuterCounter += 2
Do While (intInnerCounter >= 2 And intInnerCounter <= 4)
intInnerCounter += 1
intTotal += intInnerCounter
Loop
Loop
In the first loop I get 18, then in the second I get 12. The goal is to get the same result. I need to keep it a nested loop. What's wrong?[edit]Added VB tags[/edit]
Last edited by a moderator: