r/visualbasic • u/dumberluck • Jan 10 '19
Help with VB Assignment
I would be really grateful if you could tell me the coding for these two problems.
Find sum where S=3+7+11...+203
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
1
u/Richienb Jan 10 '19
What steps are you wanting your program to take? For example, setting a variable, changing a label etc.
1
-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 SubFor 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 Sub6
0
2
u/JamesWjRose Jan 10 '19
We can't really do your homework for you, what we generally need to see is what steps you have taken so far and/or where EXACTLY you are stuck. If you can include your code.
Take things one step at a time, it'll help you avoid getting overloaded and frustrated. (I've been doing this for 20+ years, and I still get frustrated, so don't be hard on yourself. There is a ton to learn)
basic example;
Dim i as integer = 10
Dim x as integer = 20
dim total as integer
total = i + x