Depending on whether the "or" is exclusive or inclusive:
1365 if exclusive
1710 if inclusive
Presumably it's inclusive so the answer is 1710.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For n = 10027 To 99999 Step 37
s = LTrim(Str(n))
has3 = Sgn(InStr(s, "3"))
has7 = Sgn(InStr(s, "7"))
If has3 Then
If has7 Then ctboth = ctboth + 1 Else ct3 = ct3 + 1
ElseIf has7 Then
ct7 = ct7 + 1
End If
Next
Text1.Text = Text1.Text & ct3 + ct7 & " if exclusive" & crlf
Text1.Text = Text1.Text & ct3 + ct7 + ctboth & " if inclusive" & crlf
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2015-08-06 13:30:07 |