在text1,text2分别输入两个整数n1,n2,若n1大于n2,那么交换两数,用vb求
在text1,text2分别输入两个整数n1,n2,若n1大于n2,那么交换两数,用vb求区间【1,n2】所有是13和15的倍数的整数,并在label1输出...
在text1,text2分别输入两个整数n1,n2,若n1大于n2,那么交换两数,用vb求区间【1,n2】所有是13和15的倍数的整数,并在label1输出
展开
1个回答
展开全部
Private Sub Command1_Click()
Dim n1 As Integer, n2 As Integer, t As Integer
n1 = Text1
n2 = Text2
If n1 > n2 Then
t = n1
n1 = n2
n2 = t
End If
For i = n1 To n2
If i Mod 13 = 0 Or i Mod 15 = 0 Then '是13的倍数或是15的倍数
Label1.Caption = Label1.Caption & i & " "
End If
Next i
End Sub
Dim n1 As Integer, n2 As Integer, t As Integer
n1 = Text1
n2 = Text2
If n1 > n2 Then
t = n1
n1 = n2
n2 = t
End If
For i = n1 To n2
If i Mod 13 = 0 Or i Mod 15 = 0 Then '是13的倍数或是15的倍数
Label1.Caption = Label1.Caption & i & " "
End If
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询