VB程序题1.求S=1+3+5+7+---+99的值.1.求S=1+3+5+7+---+99的值.2.求N!的值,其中N由键盘输入.3.从键盘上输入这些数:10,11,6,15,33,21,7然后按相反的顺序:7,21,33,15,6,11,10在窗体上显示.4.设计一个窗体,从键盘上
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 05:49:45
VB程序题1.求S=1+3+5+7+---+99的值.1.求S=1+3+5+7+---+99的值.2.求N!的值,其中N由键盘输入.3.从键盘上输入这些数:10,11,6,15,33,21,7然后按相反的顺序:7,21,33,15,6,11,10在窗体上显示.4.设计一个窗体,从键盘上
VB程序题1.求S=1+3+5+7+---+99的值.
1.求S=1+3+5+7+---+99的值.
2.求N!的值,其中N由键盘输入.
3.从键盘上输入这些数:10,11,6,15,33,21,7然后按相反的顺序:7,21,33,15,6,11,10在窗体上显示.
4.设计一个窗体,从键盘上输入10个数,显示其中最大的数,界面如图3-10所示.
VB程序题1.求S=1+3+5+7+---+99的值.1.求S=1+3+5+7+---+99的值.2.求N!的值,其中N由键盘输入.3.从键盘上输入这些数:10,11,6,15,33,21,7然后按相反的顺序:7,21,33,15,6,11,10在窗体上显示.4.设计一个窗体,从键盘上
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
Print
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(Text1.Text)
a(2) = Val(Text2.Text)
a(3) = Val(Text3.Text)
a(4) = Val(Text4.Text)
a(5) = Val(Text5.Text)
a(6) = Val(Text6.Text)
a(7) = Val(Text7.Text)
a(8) = Val(Text8.Text)
a(9) = Val(Text9.Text)
a(10) = Val(Text10.Text)
For i = 1 To 10
If a(i) > max Then max = a(i)
Next i
Text11.Text = max
End Sub