vb输出30以内的勾股数
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/10 20:36:58
vb:dimiasintegerfori=7to100step7ifimod7=0thenme.printiendifnextivc:inti=0;for(i=7;i
DimiasInteger,jasInteger,oasIntegerj=0o=0Fori=1To100Step2j=j+io=o+(i+1)NextDebug.print"100以内的奇数和:"&j
在VB中,Print语句具有计算功能,它能计算表达式的值,然后再输出它.所以,这里先计算2-2=0,然后就输出0.如果写Print2+3*10的话就会输出32.
PrivateSubForm_load()DimiAsIntegerDimjAsIntegerDimxAsIntegerFori=2To10000f=0'f用来标识是否为素数Forj=2ToInt(S
PrivateSubCommand1_Click()Fori=1To100Forj=1ToiFork=1TojIfi^2=j^2+k^2ThenPrinti;j;kNextkNextjNextiEnd
PrivateSubCommand1_Click()Dima()Fori=100To1Step-1Forj=i-1To1Step-1IfiModj=0Thenn=n+1NextIfn=1Thenm=m
…前面那个定义I=1,i再问:啊啊啊没看懂呀~你帮我把代码写出来吧~
PrivateSubCommand1_Click()Fori=2To1000Forj=2ToiIfiModj=0ThenExitForNextjIfj=iThenPrinti;NextiEndSu
OptionExplicitPrivateSubForm_Click()Form1.AutoRedraw=TrueClsDimAAsInteger,SuAsBoolean,IAsInteger,JAs
PrivateSubCommand1_Click()Fori=1To98Forj=i+1To99Fork=j+1To100Ifi*i+j*j=k*kThenPrinti;j;k,:s=s+1:IfsM
dimiaslong,jaslong,kaslongfori=1to1000forj=ito1000fork=jto1000ifi*i+j*j=k*kthenprinti,":",j,":",knex
PrivateSubCommand1_Click()Dima(30)asIntegerIfOption1.Value=TrueThena(1)=1a(2)=1Fori=3To30a(i)=a(i-1)
Private Sub Form_Load()Dim I As IntegerForm1.AutoRedraw = TrueFor
在界面上放一个按钮就行了,然后将下面的代码复制到代码窗口.PrivateSubCommand1_Click()Me.Clsi=0Forj=1To500IfjMod17=0ThenIfi=5Theni=
OptionExplicit'设计时要设置text4的multiline属性为T'设计时要设置text4的scrollbars属性为2PrivateSubCommand1_Click()DimiAsL
添加一个Listbox控件然后Ifc=Fix(c)Andc
dima(30)fori=1to30a(i)=int(rnd(97+3))ifisprime(a(i))=truethenprinta(i);nextifunctionisprime(xasinteg
Private Sub Command1_Click() Cls Dim r(
PrintFormat(2,"0.000")PrintFormat(3.1444,"0.000")
PrivateSubForm_Click()Dima(30)AsIntegerDimiAsIntegerRandomizeFori=1To30a(i)=Int(100*Rnd)NextiFori=1T