求vb程序设计答案
有一堆苹果,个数在50~500之间,按5人均分余4个,按6人均分余3个,按7人均分余2个,用穷举法设计程序,输出苹果有多少个?共有几种分法?...
有一堆苹果,个数在50~500之间,按5人均分余4个,按6人均分余3个,按7人均分余2个,用穷举法设计程序,输出苹果有多少个?共有几种分法?
展开
1个回答
展开全部
Private Sub Command1_Click()
Dim I, J As Integer
J = 0 ' 几种分法
For I = 50 To 500
Debug.Print "A"
If I Mod 5 = 4 And I Mod 6 = 3 And I Mod 7 = 2 Then
J = J + 1
Text1.Text = I & ";" & Text1.Text
Text2.Text = J
End If
Next
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
Dim I, J As Integer
J = 0 ' 几种分法
For I = 50 To 500
Debug.Print "A"
If I Mod 5 = 4 And I Mod 6 = 3 And I Mod 7 = 2 Then
J = J + 1
Text1.Text = I & ";" & Text1.Text
Text2.Text = J
End If
Next
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询