Search code examples
digitti-basic

How to count digits of a number?


I'm making a program on my TI-84, and I'm in need of a way to count the digits of a number.

How would I go about doing that?


Solution

  • It's been a long time since I've touched TI-Basic, however, I do know that there is a mathematical means of counting digits of a number. Since each place is a multiple of 10, you should just be able to use the (base 10 log of your number) plus one. This is assuming you're using positive integers.

    An alternative and more general solution is to get the length of the number converted to a string. Looks like there is some documentation here: http://tibasicdev.wikidot.com/number-to-string2