关于VB的一个问题。急~

来源:百度知道 编辑:UC知道 时间:2024/09/24 01:15:39
要求实现1+3+5+7...+100=?
是1+3+5+7+9...+99 刚才急了写错了~!

Dim sum, i As Integer

sum = 0
For i = 1 To 99 Step 2
sum = sum + i
Next

MsgBox sum

Dim temp as long
temp = 0
For i = 1 To 100 Step +2
temp = temp+i
next i

dim i,t=0 as integer
for i=1 to 99 step 2
t=t+i
这不就OK 了吗!

...
用循环做呗