vb:在窗体上添加一命令按钮,单击它,在出现的输入框中输入整数N.调用过程qsum,功能是求:1+2+3+。。。+N
2个回答
2015-07-16
展开全部
Private Sub Command1_Click()
Dim N As Integer, S As Double
N = Val(InputBox("请输入整数N"))
Call qsum(N, S)
Print S
End Sub
Private Sub qsum(ByVal N As Integer, S As Double)
Dim i As Integer, m As Double
For i = 1 To N
m = m + i
Next i
S = m
End S
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询