100以内的奇数和偶数之和代码 VB
问题描述:
100以内的奇数和偶数之和代码 VB
答
Dim i as Integer,j as Integer,o as Integer
j = 0
o = 0
For i = 1 To 100 Step 2
j = j + i
o = o + (i + 1)
Next
Debug.print "100以内的奇数和:" & j & ",偶数和:" & o