CIS 230 - Visual Basic
Ch. 7 Worksheet #1 Answers
Determine how many times the following loops iterate and determine the final values of any variables upon the termination of each loop. If the loop is an infinite, simply write "infinite loop". If there is a syntax error, write "syntax error".
1. For j = 1 To 11 j = 12 11 iterations |
2. For m = 10 To 23 Step 4 statements Next m m = 26 4 iterations |
3. For intLoop = 1 To
Len("Georgia") intLoop = 8 7 iterations |
4. k = 2 k = 10 8 iterations |
5. w = 45 w = 10 7 iterations |
6. a = 5 a = infinite loop b = 3 infinite loop |
7. c = 13 c = 19 d = -17 3 iterations |
8. For s = 14 To 28
Step 4/2 s = 30 8 iterations |
9. For h = 15 To 3
Step -5 h = 0 3 iterations |