VB程序求出各位数为6且能被3整除的三位数共有多少个?
展开全部
建个按钮控件:(下程序还可以显示每个数)
'VB程序求出各位数为6且能被3整除的三位数共有多少个?
Private Sub Command1_Click()
Dim cout As Integer
For i = 100 To 999
If i Mod 10 = 6 And i Mod 3 = 0 Then
Print i;
cout = cout + 1
If cout Mod 5 = 0 Then
Print
End If
End If
Next
Print cout;"个"
End Sub
------------------
下面这个只能求个数
'VB程序求出各位数为6且能被3整除的三位数共有多少个?
Private Sub Command1_Click()
Dim cout As Integer
For i = 100 To 999
If i Mod 10 = 6 And i Mod 3 = 0 Then
cout = cout + 1
End If
Next
Print cout; "个"
End Sub
'VB程序求出各位数为6且能被3整除的三位数共有多少个?
Private Sub Command1_Click()
Dim cout As Integer
For i = 100 To 999
If i Mod 10 = 6 And i Mod 3 = 0 Then
Print i;
cout = cout + 1
If cout Mod 5 = 0 Then
End If
End If
Next
Print cout;"个"
End Sub
------------------
下面这个只能求个数
'VB程序求出各位数为6且能被3整除的三位数共有多少个?
Private Sub Command1_Click()
Dim cout As Integer
For i = 100 To 999
If i Mod 10 = 6 And i Mod 3 = 0 Then
cout = cout + 1
End If
Next
Print cout; "个"
End Sub
展开全部
Dim NCount As Integer
Private Sub Form_Load()
For i = 1 To 999
If Right(i, 1) = "6" Then
If i Mod 3 = 0 Then
List1.AddItem i
NCount = NCount + 1
End If
End If
Next i
MsgBox "个位数为6且能被3整除的三位数有" & NCount & "个"
End Sub
在窗体上放一个ListBox控件
Private Sub Form_Load()
For i = 1 To 999
If Right(i, 1) = "6" Then
If i Mod 3 = 0 Then
List1.AddItem i
NCount = NCount + 1
End If
End If
Next i
MsgBox "个位数为6且能被3整除的三位数有" & NCount & "个"
End Sub
在窗体上放一个ListBox控件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
求出各位数为6且能被3整除的三位数共有多少个?
print ((996-106)/10+1)\3;
select case (996-106)/10+1) mod 3
case 1 :if 106 mod 3 =0 then print "+1"
case 2 :if 106 mod 3 <>1 then print "+1"
end select
print ((996-106)/10+1)\3;
select case (996-106)/10+1) mod 3
case 1 :if 106 mod 3 =0 then print "+1"
case 2 :if 106 mod 3 <>1 then print "+1"
end select
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
For i = 106 To 996 Step 10
If i Mod 3 = 0 Then j = j + 1
Next
Print j
End Sub
For i = 106 To 996 Step 10
If i Mod 3 = 0 Then j = j + 1
Next
Print j
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询