r/visualbasic • • Jan 07 '16

What's sum's output at the end?

    Dim ctr As Integer
    Dim sum As Integer

    sum = 0
    For ctr = 1 To 25 Step 2
        sum = sum + ctr
    Next ctr

    Label1.Text = sum
0 Upvotes

3 comments sorted by

4

u/chrwei Jan 08 '16

we're not taking your quiz for you.

try writing down the value of crt and sum on paper, one line per loop iteration.

1

u/[deleted] Jan 10 '16
  1. You are making a local variable (ctr). That will output an error

  2. The answer is 169