Page 1 of 1
I must be bored - lol
Posted: Sun Apr 12, 2020 7:25 pm
by Evil1
I must be bored during this lockdown, someone posted this on PussJotter :-
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
Re: I must be bored - lol
Posted: Sun Apr 12, 2020 8:20 pm
by TI-994A
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
Slightly shorter:
Code: Select all
For i = 1 To 100 : a$ + Str(i) : Next
Debug CountString(a$, "9")
Re: I must be bored - lol
Posted: Sun Apr 12, 2020 8:26 pm
by infratec
All totally wrong
He don't need any 9's.
He only needs 6's and turn them.

Re: I must be bored - lol
Posted: Sun Apr 12, 2020 8:36 pm
by TI-994A
infratec wrote:He don't need any 9's.
He only needs 6's and turn them.
Or he might not need any 6's, but more 9's instead.

Re: I must be bored - lol
Posted: Sun Apr 12, 2020 9:20 pm
by Evil1
TI-994A wrote: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
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 thing
Slightly shorter:
Code: Select all
For i = 1 To 100 : a$ + Str(i) : Next
Debug CountString(a$, "9")
And I thought about the upside down sixes too and was told - nope :-p