编写vb代码计算下列数列之和x 1!,-x³ 3!
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/10 16:43:57
PrivateSubCommand1_Click()x=Text1.Texts=1a=1Dok=k+1a=a*-1*x^2/((2*k-1)*(2*k))s=s+aLoopUntilAbs(a)Tex
PrivateSubCommand1_Click()Printcalc(1000,0.05,10)EndSubPrivateFunctioncalc(baseAsSingle,rateAsSingle
FunctionS(rAsSingle)AsSingle'Function过程Constpi=3.1415926535898S=pi*r^2EndFunctionPrivateSubForm_Clic
PrivateSubCommand1_Click()DimnAsLong,xAsSingle,yAsSingle,y2AsSingle,sumAsSinglex=Val(InputBox("请输入一个
PrivateSubCommand1_Click()Dima,xAsSinglea=Val(Text1.Text)Ifa再问:x=x+a*0.2+3000*0.2怎么都乘0.2呀?
OptionExplicitPrivateSubCommand1_Click()DimsAsSingle,nAsLong,stAsStringn=1s=0DoDoEventss=s+nst=st&nI
一个text控件PrivateSubForm_Load()DimRAsDoubleDimSAsDoubleR=Val(Text1.Text)S=3.14*(R^2)MsgBoxStr(S)EndSu
程序开始是↓----退出?|↓否|等待←-------|↓无||键盘输入?------|↓有||显示在文本框------||---结束
DimiasInteger,jasInteger,oasIntegerj=0o=0Fori=1To100Step2j=j+io=o+(i+1)NextDebug.print"100以内的奇数和:"&j
PrivateSubCommand1_Click()DimsAsString,nAsInteger,iAsIntegerFori=1To100n=n+iNextiPrint"1+2+3+……+100=
clearall;clc;y=((sin(log(5))+log10(108)+64^(1/5))/asin(0.5))*exp(abs(sind(175)))y=11.1067
Sum=0Fori=100To300IfiMod21=0ThenSum=Sum+iEndIfNext==>优化一点:Sum=0Fori=100To300IfiMod21=0ThenSum=Sum+ii
function[a]=my_normalize(a)a_max=max(a);a=a/a_max;a=ceil(a*5);%--yourmainprogram---a=[yourvectordata
VB程序斐波那契数列代码ma,b,ciasintegera=1b=1fori=3to10c=aba=bb=cdebug.printcnexti
PrivateSubCommand1_Click()Dima,b,c,area,cca=Val(InputBox("请输入第一个数"))b=Val(InputBox("请输入第二个数"))c=Val(
PrivateSubCommand1_Click()DimnAsInteger,iAsInteger,jAsInteger,Sum&,m&n=Val(InputBox("请输入N值"))Sum=0Fo
不知你需要什么种类的三角函数,我编了一种,你可以依样画葫芦编出其他Constpi=3.14159PrivateSubCommand1_Click()DimxAsDoublex=InputBox("x=
PrivateSubCommand1_Click()Dimi,nAsIntegerDima()AsIntegern=Val(InputBox("序列的个数","",4))IfnReDima(1Ton)
说明VB不支持ln函数,换句话说,VB的log函数就是数学中的ln函数,而常用对数lg只能使用换底公式lg(x)=log(x)/log(10)条件很简单x>0.
PrivateSubCommand1_Click()Dimsum,xx=0sum=0Fori=1To200x=x+2*(i-1)sum=sum+xNextPrintsum'结果为2666600EndS