VB中用do while语句求1-100中被3和5同时整除的个数 if k mod 3=0 and k mod 5=0 then i
答案:2 悬赏:80 手机版
解决时间 2021-03-17 06:07
- 提问者网友:一抹荒凉废墟
- 2021-03-16 17:19
VB中用do while语句求1-100中被3和5同时整除的个数 if k mod 3=0 and k mod 5=0 then i
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-03-16 18:48
i = 0
k = 1
Do While k <= 100
If k Mod 3 = 0 And k Mod 5 = 0 Then i = i + 1
k = k + 1
Loop
MsgBox "1-100之间能被3和5整除的数的个数为:" & i
k = 1
Do While k <= 100
If k Mod 3 = 0 And k Mod 5 = 0 Then i = i + 1
k = k + 1
Loop
MsgBox "1-100之间能被3和5整除的数的个数为:" & i
全部回答
- 1楼网友:不如潦草
- 2021-03-16 20:14
Dim i As Integer, sum As Integer
sum = 0
i = 1
Do While i <= 40
If i Mod 5 = 0 Then
sum = sum + i
End If
i = i + 1
Loop
MsgBox sum
sum = 0
i = 1
Do While i <= 40
If i Mod 5 = 0 Then
sum = sum + i
End If
i = i + 1
Loop
MsgBox sum
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯