> 其他 >
vb 编程 计算100~300之间所有能被3和7整除的数之和,求代码
人气:118 ℃ 时间:2019-08-20 22:06:51
解答
Sum = 0
For i = 100 To 300
If i Mod 21 = 0 Then
Sum = Sum + i
End If
Next
==>
优化一点:
Sum = 0
For i = 100 To 300
If i Mod 21 = 0 Then
Sum = Sum + i
i = i + 20
End If
Next
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版