vb中产生10个100以内的随机整数,赋给一个数组,并求出2或5的倍数及倍数的和
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/11 10:34:24
Private Sub Command1_Click()Text1.Text = ""Dim A(1 To 1
PrivateSubForm_Load()Dima(10),i,x,jAsIntegerDimyAsStringFori=0To9Randomizea(i)=Int(Rnd(1)*101)x=x+a(
PrivateSubCommand1_Click()DimxxAsIntegerDimNAsLong,FlagsAsBooleanDimiiAsIntegerDim素数个数AsIntegerDim素数
For i = 1 To 10 改为 For i = 0 To 9For&nbs
Dima(9)AsIntegerRandomizea(0)=Int(Rnd()*21+10)Doa(1)=Int(Rnd()*21+10)LoopWhilea(1)=a(0)Doa(2)=Int(Rn
这样才对初始化应加在For循环里s要变为双精度(这样平均数才有小数点后几位)楼主试我这个:PrivateSubCommand1_Click()Dimi%,j%,max%,min%,s%Fori=1To
int(10+rnd()*90)
Dimy%,x%Fori=1To10x=Int(Rnd*100)'[0,99]Printx;Ifi=1Theny=xElseIfy>xTheny=xEndIfNextiPrint"最小值";x如果是N
窗体加一按钮,一个文本框PrivateSubCommand1_Click()RandomizeFori=1To100Text1.Text=Int(Rnd*90)+10NextEndSu
dima(9)asintegerprivatesubcommand1_click()dimiasintegerrandomizefori=0to9a(i)=int(rnd*101)text1.text
subform_click()dima%(20)fori=1to20a(i)=int(rnd()*10+1)printa(i),nextendsu
通过SubMain启动Submain()Dima(9)AsInteger,pAsDouble,iAsInteger,nAsIntegerp=0n=0Fori=0To9a(i)=Rnd*100p=p+a
楼主看看这个:Private Sub Command1_Click() Dim aNum(19) As Long,&
Functioncalc()dimaasintegerdimbaslongfora=0to100step2b=b+a^2nextacalc=bendfunction这个算法比你的优化一些,如果你想用自
(1)Fori=0To100Debug.PrintiNext(2)Fori=1To9Debug.Print-iNext(3)Fori=10To99Debug.PrintiNext(4)Fori=&H4
PrivateSubCommand1_Click()Sum=0Fori=0To9Print10*i+7;Sum=Sum+10*i+7NextiPrintPrint"Sum=";SumEndSu
DimMyValue(10)AsIntegerDimi,j,pAsIntegerFori=0To9RandomizeMyValue(i)=Int((100*Rnd)+1)NextFori=0To9Fo
是“奇数”吗..?另外一共就产生十个,每行显示十个……是不是产生任意多个,然后每行输出十个?奇数的话范围就在11~99之间,用2n+1法产生奇数的话n的取值范围就是5~49新建工程,窗体上放个文本框,
vb6测试通过PrivateSubCommand1_Click()Dima(10)AsInteger,tempAsInteger,iAsInteger,jAsIntegerRandomizetemp=
Option ExplicitPrivate Sub Form_Load()RandomizeMe.AutoRedraw = TrueDim