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...
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所示。 展开
2.求N!的值,其中N由键盘输入。
3.从键盘上输入这些数:10, 11, 6, 15,33,21,7然后按相反的顺序:7,21,33,15,6,11,10在窗体上显示。
4.设计一个窗体,从键盘上输入10个数,显示其中最大的数,界面如图3-10所示。 展开
2个回答
展开全部
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
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(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
2012-06-10
展开全部
sub test()
dim i as integer,res as long
for i=1 to 99 step 2
res=res+i
next i
print res
end sub
dim i as integer,res as long
for i=1 to 99 step 2
res=res+i
next i
print res
end sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |