Private Sub Command1_Click()
Dim n1, n2, buf, mid, result As Integer
n1 = Val(Text1.Text)
n2 = Val(Text2.Text)
buf = 0
result = 0
'å
å¤æè¦ç´¯å å¤å°æ¬¡
For i = n1 To n2
buf = buf + 1
Next i
MsgBox buf
mid = Int(buf / 2)
'å¤æ个æ°æ¯å¦å¶æ°
If (buf Mod 2 = 0) Then result = (n1 + n2) * mid
If (buf Mod 2 = 1) Then result = (n1 + n2) * mid + (n1 + mid)
MsgBox mid
MsgBox result
End Sub
温馨提示:答案为网友推荐,仅供参考