发布网友 发布时间:2023-08-27 13:34
共1个回答
热心网友 时间:2023-10-11 04:17
① i mod 2
②s2=s2+i
③s2
④s1
注:S2为偶数和,S1为奇数和
Private Sub Command1_Click()
Dim s1 As Single, s2 As Single, i As Integer
s1 = 0
s2 = 0
For i = 1 To 100
If i Mod 2 = 1 Then '第一空
s1 = s1 + i
Else
s2 = s2 + i
End If
Next i
Text1.Text = s2 '第三空
Text2.Text = s1 '第四空
End Sub
看图,这是上面代码运行结果