I calculated it in my head and failed miserably, so wrote some code - lol :-
Code: Select all
For a=1 To 100
a$=Str(a)
For b=1 To Len(a$)
If Mid(a$,b,1)="9": nine+1:Debug a$:EndIf
Next b
Next a
Debug nine
Code: Select all
For a=1 To 100
a$=Str(a)
For b=1 To Len(a$)
If Mid(a$,b,1)="9": nine+1:Debug a$:EndIf
Next b
Next a
Debug nine
Slightly shorter:Evil1 wrote:
...wrote some code - lol :-Code: Select all
For a=1 To 100 a$=Str(a) For b=1 To Len(a$) If Mid(a$,b,1)="9": nine+1:Debug a$:EndIf Next b Next a Debug nine
Code: Select all
For i = 1 To 100 : a$ + Str(i) : Next
Debug CountString(a$, "9")
Or he might not need any 6's, but more 9's instead.infratec wrote:He don't need any 9's.
He only needs 6's and turn them.
And I thought about the upside down sixes too and was told - nope :-pTI-994A wrote:Indeed shorter, muscle memory forgets about the Countrsting command - meh 15 seconds to write, I wasn't trying to win any world records - just shows I over complicate the slightest thingEvil1 wrote:
...wrote some code - lol :-Code: Select all
For a=1 To 100 a$=Str(a) For b=1 To Len(a$) If Mid(a$,b,1)="9": nine+1:Debug a$:EndIf Next b Next a Debug nine
Slightly shorter:Code: Select all
For i = 1 To 100 : a$ + Str(i) : Next Debug CountString(a$, "9")