程序编程:求能被3整除且有一位数字为6的三位数个数
3个回答
展开全部
计算结果 94 用excel vba 实现。
Private Sub CommandButton1_Click()
For i = 0 To 9
For j = 0 To 9
If (i + j) Mod 3 = 0 Then
If i = 0 Then n = n + 1 Else n = n + 3
End If
Next
Next
Cells(1, 1) = n
End Sub
Private Sub CommandButton1_Click()
For i = 0 To 9
For j = 0 To 9
If (i + j) Mod 3 = 0 Then
If i = 0 Then n = n + 1 Else n = n + 3
End If
Next
Next
Cells(1, 1) = n
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
VB code:
Private Sub Command1_Click()
Dim i, s As Integer
For i = 100 To 999
If i Mod 3 = 0 And InStr(1, CStr(i), "6") > 0 Then s = s + 1
Next
Print s
End Sub
答案是84个
Private Sub Command1_Click()
Dim i, s As Integer
For i = 100 To 999
If i Mod 3 = 0 And InStr(1, CStr(i), "6") > 0 Then s = s + 1
Next
Print s
End Sub
答案是84个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询