随机数统计程序代码求最大值最小值平均值PrivateSubCommand1_Click()DimlsAsIntegerRandomizes_max=0s_min=100Fori=1To4Forj=1To5ls=Round(Rnd*100,0)+1Sum=Sum+lsText1.Text=Text1.Text-Str(ls)Ifs_maxlsThens_max=lIfs_minlsThens_min=lsNextjText1.Text=Text1.TextvbCrLfNextis_aver=Round(Sum/20,0)Text2.Text=Text2.Text-最大的数是:Str(s_max)&vbCrLfText2.Text=Text2.Text&最小的数是:&Str(s_min)&vbCrLfText2.Text=Text2.Text&平均值是:&Str(s_aver)EndSubPrivateSubCommand2_Click()Text1.Text=Text2.Text=EndSubPrivateSubCommand3_Click()IfCommand3.Caption=显示代码ThenCommand3.Caption=关闭代码Text3.Visible=TrueElseCommand3.Caption=显示代码Text3.Visible=FalseEndIfEndSubPrivateSubCommand4_Click()EndEndSubPrivateSubForm_Load()Form1.Caption=VisualBasic实验6-1Label1.Caption=随机数统计程序Label2.Caption=程序设计:太原理工大学生Command1.Caption=&P产生随机数Command2.Caption=&R系统还原Command3.Caption=显示代码Command4.Caption=&E结束Text1.Text=Text2.Text=Text3.Visible=FalseEndSub