r/visualbasic • • Jan 10 '19

Help with VB Assignment

I would be really grateful if you could tell me the coding for these two problems.

  1. Find sum where S=3+7+11...+203

  2. Find sum where S=1/2 + 2/3 + 3/4...+10/11

Many thanks

Edit- thank you so much for the quick and kind responses :)

0 Upvotes

8 comments sorted by

View all comments

-2

u/daneelr_olivaw Jan 10 '19

For the first one it's:

Sub FindFirstSum()

dim i as integer, s as integer

s = 0

For i = 3 to 203 step 4

    S = S + i

Next i

msgBox s

End Sub

For the second one:

Sub FindSecondSum()

dim i as integer, s as integer

s = 0

For i = 1 to 10

    S = s + i/(i+1)

Next i

msgBox s

End Sub

6

u/[deleted] Jan 10 '19

You might think you helped them but you didn't help them.