vb编程求1 2 3 N
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 23:07:36
Dimn,x,r,sAsSinglen=2s=0DoWhilen再问:能说一下算法的思路吗?再答:首先1不是素数,就用枚举将2到1000的每个数列举出来,再逐个检验,即从2到n/2一一举例,判断是否能
n=val(inputbox"请输入一个数字.")fori=1tona=a+inextiprinta
#include#includemain(void){intn,i;printf("请输入n的值\n");scanf("%d",&n);intsum1=1,sum2=2,sum;for(i=3;i
是没有思路,还是不会编程?至少有一位数字是5用以下的子函数boolIsInclude5(intnum){while(num!=0){if(num%10==5)returntrue;num=num/10
PrivateSubForm_Click()DimnAsIntegern=Val(InputBox("请输入N:"))Dima,bAsLonga=1:b=1Fori=1TonPrinta&""&b&"
简单就是不会再问:....再答:不是不会是好久没做了差不多都忘了呵呵
PrivateSubCommand1_Click()DimnAsInteger,iAsIntegerDimsumAsDoublen=Val(InputBox("PleaseEnterN:"))sum=
for循环修改下fori=1to2n-1step2a=a+inexti
PrivateSubForm_Click()DimHeAsLongDimIAsInteger,MAsInteger,NAsIntegerM=Int(Val(InputBox("M的值","输入",3)
PrivateSubCommand1_Click()DimmAsInteger,nAsIntegerm=Int(InputBox("输入第一个整数"))n=Int(InputBox("输入第一个整数"
代码:Private Sub Command1_Click() Call max100End SubSub&nbs
http://zhidao.baidu.com/link?url=wyic3NEB45i2K9YZE2SpNiAV4aD7rZHpluBlyF76zg0n_8wr1t6-KOYm6eYY23KqG5n
代码如下:OptionExplicitPrivateSubCommand1_Click()MsgBoxP(2,2)EndSubFunctionP(ByValnAsInteger,ByValxAsDou
PrivateSubCommand1_Click()n=Text1.TextFori=2ToInt(Sqr(n))IfnModi=0Thenmsgbox"不是"ExitSubEndIfNextimsg
Private Sub Form_Load()Dim I As IntegerForm1.AutoRedraw = TrueFor
mModn=rr=mModn
DimmAsInteger,nAsIntegerPrivateSubCommand1_Click()m=Val(InputBox("输入正整数"))n=Val(InputBox("输入正整数"))If
很简单的~不过你问错地方了
functionsum(n)fori=1tona=a+inextsum=aendfunction
PrivateSubCommand1_Click()DimnAsInteger,iAsIntegerDimxAsVariant,sumAsDoublen=20x=CDec(x)x=1Fori=1Ton