【简答题】
Private Sub Command1_Click()
Dim i As Integer, j As Integer, iSum As Integer
Print "连续和为1250的正整数是:"
For i = 1 To 500
' iSum = ?
For j = i To 500
' iSum = ?
If iSum >= 1250 Then Exit For
Next
'If iSum = ? Then
Print i; " ~ "; j
End If
Next
End Sub
参考答案
Private Sub Command1_Click()
Dim i As Integer, j As Integer, iSum As Integer
Print "连续和为1250的正整数是:"
For i = 1 To 500
iSum = 0
For j = i To 500
iSum = iSum + j
If iSum >= 1250 Then Exit For
Next
If iSum = 1250 Then
Print i; " ~ "; j
End If
Next
End Sub