2个回答
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sum As Integer
sum = 0
Dim i As Integer
For i = 100 To 300
' 如果能被3整除且被7整除,则累加
If 0 = i Mod 3 And 0 = i Mod 7 Then
sum = sum + i
End If
Next i
MsgBox(sum)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询