28 lines
430 B
Plaintext
28 lines
430 B
Plaintext
DEF X:INT
|
|
|
|
X=1024
|
|
|
|
OPENCONSOLE
|
|
|
|
WHILE X>0
|
|
|
|
PRINT X
|
|
X=X/2
|
|
|
|
ENDWHILE
|
|
'Output starts with 1024 and ends with 1.
|
|
|
|
'Putting the following in the loop will produce output starting with 512 and ending with 0:
|
|
'X=X/2
|
|
'PRINT X
|
|
|
|
PRINT:PRINT"Press any key to end."
|
|
|
|
'Keep console from closing right away so the figures can be read.
|
|
WHILE INKEY$="":ENDWHILE
|
|
|
|
CLOSECONSOLE
|
|
|
|
'Since this is, in fact, a Creative Basic console program.
|
|
END
|