Sub a()
i = 1
j = 1
s = 0
For i = 1 To 100 Step 1
If i Mod 3 = 0 Or i Mod 5 = 0 Then
Cells(j + 1,1) = i
s = s + i
j = j + 1
End If
Next i
Cells(1,1) = "1~100以内能被3或5整除的数之和等于" & s
End Su
Sub a()
i = 1
j = 1
s = 0
For i = 1 To 100 Step 1
If i Mod 3 = 0 Or i Mod 5 = 0 Then
Cells(j + 1,1) = i
s = s + i
j = j + 1
End If
Next i
Cells(1,1) = "1~100以内能被3或5整除的数之和等于" & s
End Su