vb统计1到1000之间能被3或者7整除的数的个数
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/12 16:48:26
privatesubform_click()dimnasinteger,iasintegerfori=7to1000ifimod7=0thenn=n+1nextprintnendsu
subcommand1_click()dimiasinteger,sasintegers=0fori=1to100if(imod3=0andimod7=0)thens=s+inextmsgboxsen
PrivateSubCommand1_Click()DimiAsIntegerDimnAsIntegern=0Fori=1To100IfiMod3=0Thenn=n+1Printn;iEndIfNex
dimnum3asintegerfori=1to1000ifimod3=0thennum3=num3+iendifnext
21X5=10521X21=44121-5+1=17个
3再答:6再答:9再答:12再答:12再答:15再答:18再答:21再答:24再答:27再答:30再答:33再答:36再答:39再答:42再答:45再答:48再答:51再答:54再答:57再答:60再
dimiasinteger,iiasintegerfori=1to1999if(imod3)=0and(imod7)=0andright(i,1)=3thenii=ii+1endifnextprint
FunctionJudge(NAsInteger)AsBooleanJudge=NMod17*37=0EndFunctionPrivateSubForm_Click()DimiAsIntegerFor
先在窗体上添加一个TextBox文本框(将其Multiline属性设置为True,并调整宽高以便能较好的显示出100个随机数)和一个Button按钮.然后双击Button按钮跳转到代码编辑窗口,粘帖以
设置了没5个换行PrivateSubBcompute_Click()t=0Fori=1To12260If(iMod3=0)And(iMod7=0)And(iMod9=0)ThenTresult.Tex
PrivateSubCommand1_Click()s=0Fori=100To200IfiMod3=0Thens=s+iEndIfNextiText1.Text=sEndSu
inta3=0,a7=0,a37=0;for(inti=1;i
1填写imod6=0,指的是余数要等于0;2填写S,表示要把S输出.
Dim i, j j = 0 &
PrivateSubCommand1_Click()Fori=1To100IfiMod7=0Thenn=n+1EndIfNextiPrintnEndSu
在窗体上添加三个文本框,和一个按钮.在按钮的单击事件中写:privatesubcommand1_clickdimsumasinteger'和dimcountasinteger'个数sum=0count
PrivateSubForm_Load()ForI=1To1000IfIMod7=0ThenX=X+1IfXMod10=0ThenLabel1.Caption=Label1.Caption&vbNew
Fori=100To999IfiMod10=3AndiMod7=0ThenPrintiEndIfNexti
dimsum%,i%fori=1to40ifimod5=0thensum=sum+inextprintsum再问:mod什么意思啊没怎么听课不懂啊谢谢啊
楼上推荐的程序有个问题.3*7*9应该写成7*9,否则会漏掉63dimiasintegerdimjasintegerdimSasLongS=0fori=1to13230ifimodj=0thenS=S