vb编程:求从1累加到100过程中,当累加到哪个数时,累加结果大于等于1000?
3个回答
展开全部
Dim i As Integer, isum As Integer
isum = 0: i = 1
Do
isum = isum + i
If isum >= 1000 Then
Print i
Exit Do
Else
i = i + 1
End If
Loop
isum = 0: i = 1
Do
isum = isum + i
If isum >= 1000 Then
Print i
Exit Do
Else
i = i + 1
End If
Loop
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim i As Integer, isum As Integer
For i = 1 To 100
isum = isum + i
If isum >= 1000 Then Exit For
Next
Print i
For i = 1 To 100
isum = isum + i
If isum >= 1000 Then Exit For
Next
Print i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
i = 1
s = 0
While s < 1000
s = s + i
i = i + 1
Wend
Print i
End Sub
i = 1
s = 0
While s < 1000
s = s + i
i = i + 1
Wend
Print i
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询