如何产生八个随机数并相加求和以N1+N2+N3+N4+N5+N6+N7+N8=SUM的形式表示出来

问题描述:

如何产生八个随机数并相加求和以N1+N2+N3+N4+N5+N6+N7+N8=SUM的形式表示出来

随机数没有要求吗?那就直接用rnd了,1之间的数:
Private Sub Command1_Click()
Dim s As String,sum As Single
Randomize
For I = 1 To 8
t = Rnd
s = s & t & "+"
sum = sum + t
Next
Print Left(s,Len(s) - 1); "=" & sum
End Sub