VB:产生30个1-100之间的随机数,统计并输出其中奇数和偶数的个数
问题描述:
VB:产生30个1-100之间的随机数,统计并输出其中奇数和偶数的个数
答
Private Sub Form_Click()Dim a(30) As IntegerDim i As IntegerRandomizeFor i = 1 To 30a(i) = Int(100 * Rnd)Next iFor i = 1 To 30If a(i) Mod 2 = 0 ThenText1 = Val(Text1) + 1Text4 = Text4 & a(i) & vbCrLfE...