vb输出1~100间所有既不能被8整除,也不能被3整除的整数
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/10 20:32:50
PrivateSubForm_click()DoUntili+7>100i=i+7Printi;LoopEndSu
pravitesubcommand1_Click()dimn%n=inputbox("请输入一个整数","输入整数")ifnmod3=0andnmod7=0thenprint"A"elseprint"
代码如下:运行条件:form1上有一个文本框,名称text1,一个按钮,名称command1运行结果显示在text1里面PrivateSubCommand1_Click()DimiAsIntegerM
PrivateSubCommand1_Click()Fori=3To100Forj=2ToSqr(i)IfiModj=0ThenExitForNextIfj>Int(Sqr(i))Thens=s&i&
PrivateSubCommand1_Click()Fori=1To100Forj=1ToiFork=1TojIfi^2=j^2+k^2ThenPrinti;j;kNextkNextjNextiEnd
/>vararr=[];//存放结果varnum=1;//初始变量while(num再问:用while循环嘛!我看不懂,表示有鸭梨再答:这就是while循环啊
PrivateSubForm_Click()Dimx1%,x2%,count%count=0Fori=1To100x1=iMod5x2=iMod7Ifx1=0Andx2=0ThenPrinti;End
PrivateSubCommand1_Click()Fori=1To98Forj=i+1To99Fork=j+1To100Ifi*i+j*j=k*kThenPrinti;j;k,:s=s+1:IfsM
PrivateSubForm_Click()DimiAsIntegerFori=1To100IfiMod3=0AndiMod7=0ThenPrintiEndIfNextEndSu
'10个数相乘?PrivateSubCommand1_Click()Dimi,nn=1Fori=1To10n=n*iNextMsgBoxnEndSu
.这点小问题先定义一下整数变量a,b,cDimaasintegerDimbasintegerDimcasintegerDimstrasStringString=""Fora=0To9Forb=0To9
一共900个数,5的倍数有900/5=180个7*14
sum=0fori=1to100if(imod3)thensum=sum+inextiprintsum
PrivateSubForm_Load()ForI=1To1000IfIMod7=0ThenX=X+1IfXMod10=0ThenLabel1.Caption=Label1.Caption&vbNew
在界面上放一个按钮就行了,然后将下面的代码复制到代码窗口.PrivateSubCommand1_Click()Me.Clsi=0Forj=1To500IfjMod17=0ThenIfi=5Theni=
PrivateSubCommand1_Click()Fori=100To200IfiMod30Thens=s+iPrinti;n=n+1IfnMod10=0ThenPrintEndIfNextPrin
Fori=100To999IfiMod10=3AndiMod7=0ThenPrintiEndIfNexti
dimsum%,i%fori=1to40ifimod5=0thensum=sum+inextprintsum再问:mod什么意思啊没怎么听课不懂啊谢谢啊
PrivateSubCommand1_Click()Dima()AsIntegerDimkAsInteger,mAsInteger,iAsInteger,jAsIntegerk=0Form=2To10
Private Sub Command1_Click() Dim j As Long, x&n