Computer Programming                                              Name -

WDTPD Worksheet #5                                              Period -

Evaluate the following programs and list the running values of the loop variables, counters, and accumulators in the columns provided. Put single slashes through past values and circle the final value in each column.

Dim A, B As Integer                            A                B
B = 15

For A = 10 To 1 Step -1
     B = B - 1
Next A

End

 

Dim M, N, P As Integer                                                                          M         N           P

For M = -10 TO 5 Step 5
     N = N + 5
     P = P + M
Next M

End

 

 

Dim J, K As Integer                                   J                K
K = 1

For J = 1 To 10 Step (2 + 2)
     K = K * 2
Next J

End

 

Dim R, S As Integer                                                                                  R              S             

For R = 100 To 1 Step -1
     If R Mod 3= 0 Then S = S + 1
Next R

End

 

Dim F As Integer                           F                                 H
Dim H As String
H = "a"

For F = 1 To 20
     H = STR$(F) & "p"
Next F

End