CIS 230 - Visual Basic

Ch. 7 Worksheet #4

Determine the final values of any variables upon the termination of each loop. If the loop is infinite, simply write "infinite loop". If there is a syntax error, write "syntax error".

1.

For k = 20 To 30 Step 2
  statements
Next k

k=

2.

t = 40

Do
   t = t - 4
Loop Until t < 8

t =

3.

f = 69
g = 60

Do While f < 60 Or g > 51 Step -2
   f = f - 1
   g = g + 1
Loop

f =
g =

4.

q = 65

Do
   q = q + 6
Loop Until q > 100

q=

5.

For z = 25 To 125 Step 25
    statements
Next z

z =

6.

v = 12
m = 37

Do
   v = v + 2
   m = m - 3
Loop Until v >= 34 And m <= 10

v =                              m =