VB求100-200之间不能被3整除的数do
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/12 05:53:44
PrivateSubCommand1_Click()Dima(1To20)Dimmax,ave,min,summax=0min=300Print"产生的20个数为:";Fori=1To20a(i)=I
PrivateSubCommand1_Click()DimiAsIntegerDimnAsIntegern=0Fori=1To100IfiMod3=0Thenn=n+1Printn;iEndIfNex
dimi,sfori=200to300s=imod5ifs=""thenprintiendif再问:大哥对不对啊我马上要考VB了,再答:PrivateSubCommand1_Click()Dimi,s
#includeintmain(){inti;for(i=100;i
Sum=0Fori=100To300IfiMod21=0ThenSum=Sum+iEndIfNext==>优化一点:Sum=0Fori=100To300IfiMod21=0ThenSum=Sum+ii
PrivateSubCommand1_Click()s=0Fori=100To200IfiMod3=0Thens=s+iEndIfNextiText1.Text=sEndSu
Sub Main() dim i as integer, n as integer&
1填写imod6=0,指的是余数要等于0;2填写S,表示要把S输出.
PrivateSubCommand1_Click()DimsAsIntegerFori=100To200IfiMod3=0AndiMod70Thens=s+iNextiPrint"所求的和为:"&sE
2500再问:过程,谢谢再答:1+3+5+...+9999+97+95+...+1(1+99)×50÷2=2500
for(inti=100;i
dimiasintegerdimsumasintegersum=0fori=100to200step5ifimod30thensum=sum+inext
在窗体上添加三个文本框,和一个按钮.在按钮的单击事件中写:privatesubcommand1_clickdimsumasinteger'和dimcountasinteger'个数sum=0count
PrivateSubCommand1_Click()Fori=100To999IfIsPrime(i)Thenn=n+1Printi;IfnMod10=0ThenPrintEndIfNextiEndS
PrivateSubCommand1_Click()Fori=100To200IfiMod30Thens=s+iPrinti;n=n+1IfnMod10=0ThenPrintEndIfNextPrin
Fori=100To999IfiMod10=3AndiMod7=0ThenPrintiEndIfNexti
PrivateSubCommand1_Click()Dimi,j,kFori=101To200Step2'每次加二,确保奇树IfiMod3>0Then'不能被3整除j=j&Str(i)&","'要打印
PrivateSubCommand1_Click()Fori=iTo100IfiMod5=0OriMod7=0Thens=s+iEndIfNextiPrint"能被5或都7整除的数之和为"&sEndS
楼上算法有问题,多了几个PrivateFunctionprime(nAsInteger)AsBoolean'返回值=True是素数,False不是素数DimkAsIntegerprime=TrueFo
Option ExplicitPrivate Sub Form_Load()RandomizeMe.AutoRedraw = TrueDim