Private Sub Command1_Click() Dim m As Integer, n As Integer m = Text1 n = Text2 s = 0 For i = m To n If i Mod 2 = 1 Then s = s + i Next i Print s End Sub
Private Sub Form_Load() Label1.Caption = "整数m" Label2.Caption = "整数n" Text1 = "" Text2 = "" Command1.Caption = "计算" End Sub
更多追问追答
追问
那这题怎么做😔
追答
Private Sub Command2_Click() Dim n As Integer n = Text1 If n < 0 Then MsgBox "负数" Else MsgBox "非负数" End Sub
Private Sub Form_Load() Label1.Caption = "输入整数" Text1 = "" Command2.Caption = "判断" End Sub