VB编程计算1*2*3 2*3*4
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 18:29:39
数学计算可以简化过程:因为1-2=-1,3-4=-1...所以得出-1+(-1)+...,重复(100/2)次,即代码为(这是最简单而且最快速的办法):DimsAsInteger=-(100/2)如果
第一题:两个TextBox,一个Command.OptionExplicitPrivateFunctionMaxModNum_(ByValaAsLong,ByValbAsLong)_AsLongDim
n=val(inputbox"请输入一个数字.")fori=1tona=a+inextiprinta
PrivateSubCommand1_Click()Dimi,sAsIntegerFori=1To100s=s-i*(-1)^iNextiPrintsEndSub这个很简单了你应该看得懂吧!
PrivateSubForm_Activate()a5EndSubSuba(nAsLong)DimiAsLongFori=1TonSum=Sum+1/f(i)NextiPrintSumEndSubFu
这样的题目主要是利用Mod运算,能被13整除,n就加1,代码如下:PrivateSubCommand1_Click()Fori=1To9999IfiMod13=0Thenn=n+1EndIfNexti
PrivateSubForm_Load()DoDimaAsSingle,bAsSingle,cAsSingle,pAsSingle,sAsSinglea=Val(InputBox("请输入三角形第1条
Private Sub Command1_Click()Dim i As Long, x As LongFor 
你这个题目可能没有写全,根据你提供的条件,Y在X5时=1,如果X在(1,5)之间,Y无解这样就可以做了,在窗体上画一个Command控件,编写如下代码PrivateSubCommand1_Click(
for循环修改下fori=1to2n-1step2a=a+inexti
你好!PrivateSubForm_Click()DimiAsIntegerDimsAsIntegerFori=1To100s=s+iNextiPrintsEndSu
publicf(byvalnasinteger)aslongifn=1thenf=1elsef=f(n-1)+nendifendfunction
privatesubcommand1-click()dimn%,y#,s&n=2:y=0:s=1dos=s*ny=y+1/sn=n+1loopuntil1/s
fori=1to98ifimod2thenm=m-1/ielsem=m+1/iendifnextmsgboxm
dimaaslongdimbaslongdimcaslongdimdassinglex1,x2也是dim(定义变量一般都是用dim)d=b^2-4acif再问:constaAslongbAslongc
PrivateSubCommand1_Click()DimiAsInteger,jAsInteger,nAsIntegerDimsum1AsLong,sum2AsLongn=inputbox("请输入
PrivateSubCommand1_Click()DimnAsDoublen=Val(InputBox("N="))Fori=1Tons=s+1/(n*(n+1))NextiMsgBox"所求的和为
PrivateSubCommand1_Click()dimiasintegerfori=1to55step2m=m+inextiprintmendsu
给出代码比较简单.流程图你就根据代码来画吧sum=0fori=1to10a=1forj=1toia=a*jnextjsum=sum+anextiprintsum
PrivateSubCommand1_Click()DimnAsInteger,iAsIntegerDimxAsVariant,sumAsDoublen=20x=CDec(x)x=1Fori=1Ton