05-22-2022, 06:47 AM
Something a bit more optimized.
Of course for very large numbers this would have to be tweaked to exclude numeric input, and just use string math.
Pete
Code: (Select All)
DO
INPUT a
a$ = LTRIM$(STR$(a))
j = 4
DO UNTIL j / 4 >= LEN(LTRIM$(STR$(ABS(a)))) / 3
a$ = MID$(a$, 1, LEN(a$) + 1 - j) + "," + MID$(a$, LEN(a$) + 1 - j + 1)
j = j + 4
LOOP
PRINT a$
LOOP
Of course for very large numbers this would have to be tweaked to exclude numeric input, and just use string math.
Code: (Select All)
DO
LINE INPUT a$
x = LEN(a$) : IF LEFT$(a$, 1) = "-" THEN x = x - 1
j = 4
DO UNTIL j / 4 >= x / 3
a$ = MID$(a$, 1, LEN(a$) + 1 - j) + "," + MID$(a$, LEN(a$) + 1 - j + 1)
j = j + 4
LOOP
PRINT a$
LOOP
Pete
If eggs are brain food, Biden takes his scrambled.