有图,运行结果
Option ExplicitPrivate Sub Form_Load()
Dim i As Integer, sum As Long
MeAutoRedraw = True
sum = 0
For i = 1 To 2000 Step 2
sum = sum + i
If sum > 2000 Then Exit For
Next i
Print "i 的最大值为:" & i
Print "sum = " & sum
End Sub
1 Private Sub Command1_Click()
Dim i As Integer, s As Long
For i = 1 To 99 Step 2
res = res + i
Next i
Print s
End Sub
2 Private Sub Command1_Click()
Dim i As Integer, N As Long, s As Long
N = Val(InputBox("请输入N的值"))
s = 1
For i = 1 To N
s = s i
Next i
Print s
End Sub
3
Private Sub Command1_Click()
Dim i As Integer, N(7) As Long
For i = 1 To 7
N(i) = Val(InputBox("请输入要倒序的数"))
Next i
For i = 1 To 7
Print N(i);
Next i
For i = 7 To 1 Step -1
Print N(i);
Next i
End Sub
4
Private Sub Command1_Click()
Dim a(10) As Long, max As Long
Dim i As Integer
a(1) = Val(Text1Text)
a(2) = Val(Text2Text)
a(3) = Val(Text3Text)
a(4) = Val(Text4Text)
a(5) = Val(Text5Text)
a(6) = Val(Text6Text)
a(7) = Val(Text7Text)
a(8) = Val(Text8Text)
a(9) = Val(Text9Text)
a(10) = Val(Text10Text)
For i = 1 To 10
If a(i) > max Then max = a(i)
Next i
Text11Text = max
End Sub
Private Sub Command1_Click()
Dim s As Single
Dim i As Long
Dim a As Long
Dim b As Long
Dim c As Long
a = 1
b = 1
s = 0
For i = 1 To 30
s = s + a / b
c = a
a = b
b = b + c
Next
Print s
End Sub
#define
s(x)
4(x)x+1
的意思是定义s(x)=
4(x)x+1这个函数,不过你要注意括号,后面这个x没括号算的时就不能加括号,因此s(k+j)=
4(5+2)5+2+1=143
以上就是关于程序功能:求s=1+3+5+7+...直到s>2000为止。vb程序全部的内容,包括:程序功能:求s=1+3+5+7+...直到s>2000为止。vb程序、VB程序题1.求S=1+3+5+7+---+99的值。、编写vb程序:s=1+1/2+2/3+3/5+… (30项)等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)