VB程序设计中如何产生随机数并分别求奇数和偶数的和
问题描述:
VB程序设计中如何产生随机数并分别求奇数和偶数的和
答
Private Sub Command1_Click()Randomize TimerFor i = 1 To 100x = Int(Rnd() * 90 + 10)If x Mod 2 = 0 Thenm = m + xElsen = n + xEnd IfNextPrint "偶数和:"; Str(m)Print "奇数和:"; Str(n)End Sub随机产生100...