vb程序设计,请写一下两道题的运行代码,谢谢,急
展开全部
Private Sub Command1_Click()
Dim x As Integer
Dim s As String
s = InputBox("请输入X值(101<= X <= 200 ")
If IsNumeric(s) Then x = CInt(s)
Do While x > 200 Or x < 101
s = InputBox("请输入X值(101<= X <= 200 ")
If IsNumeric(s) Then
x = CInt(s)
Else
x = 0
End If
Loop
Dim i As Integer
Dim sum As Integer
sum = 0
For i = 101 To x
sum = sum + i
Next
Me.Print sum
End Sub
Private Sub Command2_Click()
Dim f As Double
Dim i As Integer
f = CDbl(1)
Dim flag As Integer
flag = 1
For i = 2 To 19
flag = flag * -1
f = f + flag / (i * (i + 1))
Next
Me.Print f
End Sub
追问
不好意思问一下,第三小题从哪开始
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询