求用vb实现1到100的和加上1到50的平方和加上1到1/10的和的代码是多少?
3个回答
展开全部
现在窗口画一个Command1
代码:
Private Sub Command1_Click()
Dim s As single
s = 0
For i = 1 To 100
s = s + i
Next
For i = 1 To 50
s = s + i ^ 2
Next
For i = 1 To 10
s = s + 1 / i
Next
MsgBox s
End Sub
代码:
Private Sub Command1_Click()
Dim s As single
s = 0
For i = 1 To 100
s = s + i
Next
For i = 1 To 50
s = s + i ^ 2
Next
For i = 1 To 10
s = s + 1 / i
Next
MsgBox s
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim s As Double
s = 0
For i = 1 To 100
s = s + i
Next
For i = 1 To 50
s = s + i ^ 2
Next
For i = 1 To 10
s = s + 1 / i
Next
MsgBox s
End Sub
Dim s As Double
s = 0
For i = 1 To 100
s = s + i
Next
For i = 1 To 50
s = s + i ^ 2
Next
For i = 1 To 10
s = s + 1 / i
Next
MsgBox s
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sub
平方和()
dim
sum
dim
i
as
long
sum
=0
for
i
=
1
to
100
sum
=
sum
+
i
*
i
next
i
end
sub
平方和()
dim
sum
dim
i
as
long
sum
=0
for
i
=
1
to
100
sum
=
sum
+
i
*
i
next
i
end
sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |