Private Sub Command1_Click()
成都创新互联专注于鄠邑网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供鄠邑营销型网站建设,鄠邑网站制作、鄠邑网页设计、鄠邑网站官网定制、微信小程序定制开发服务,打造鄠邑网络公司原创品牌,更为您提供鄠邑网站排名全网营销落地服务。
Dim i As Integer
i = Text1.Text
If i Mod 2 = 0 Then
MsgBox "偶数"
Else
MsgBox "奇数"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer = Int(Rnd() * 100)
If a Mod 2 = 0 Then
MsgBox(a "是偶数")
Else
MsgBox(a "是奇数")
End If
End Sub
这个同时判定可以采用多线程做。但是一般都是使用数组循环来统计。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim A(100) As Integer
Dim n1 As Integer = 0
Dim n2 As Integer = 0
For i = 1 To 100
Randomize()
A(i) = Int(Rnd() * 1000 + 1)
If A(i) Mod 2 = 0 Then
n1 += 1
Else
n2 += 1
End If
Next
MsgBox("所产生的100个数字中偶数有" n1 "个,奇数有" n2 "个")
End Sub
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款