QBasic help

by George (no login)

How do I get numbers to be printed with 0's infront, in order to have the number only a certain amount of digits, like:

0001,0002,0003,...,0010,0011,0012,...,0100,0101,0102,...,1000,1002,...

I need this very urgent for school, and this is what I have so far. It wont display the number 0 as 000 and it only goes up to 999.

FOR i = 1 TO 199

j = 2 - INT(LOG(i) / LOG(10))

s$ = STRING$(j, "0") + LTRIM$(STR$(i))

PRINT s$

SLEEP

NEXT

Posted on Apr 23, 2011, 9:33 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
Re: QBasic helpGeorge on Apr 23
You almost had it. on Apr 23
Another solution:Solitaire on Apr 24
 That gives you E numbers... on Apr 24
 That's pretty elaborateGeorge on Apr 24