I must be bored - lol

Everything else that doesn't fall into one of the other PB categories.
Evil1
User
User
Posts: 43
Joined: Fri Jul 15, 2016 8:55 pm

I must be bored - lol

Post by Evil1 »

I must be bored during this lockdown, someone posted this on PussJotter :-

Image

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
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: I must be bored - lol

Post by TI-994A »

Evil1 wrote:Image

...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")
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
infratec
Always Here
Always Here
Posts: 6869
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: I must be bored - lol

Post by infratec »

All totally wrong :!:

He don't need any 9's.
He only needs 6's and turn them.

:mrgreen: :mrgreen: :mrgreen:
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: I must be bored - lol

Post 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. :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Evil1
User
User
Posts: 43
Joined: Fri Jul 15, 2016 8:55 pm

Re: I must be bored - lol

Post by Evil1 »

TI-994A wrote:
Evil1 wrote:Image

...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
Post Reply