Structured Programming in Basic Problems
© 1998 by Dr. Thomas W. MacFarland -- All Rights Reserved
Instructions: Review the following program and see if you can predict the outcome by completing a "pencil trace" of the code. Program output is provided at the end of this page. Compiler: The program was prepared using GWBasic, which requires the use of line numbers.
10 REM This program demonstrates how numbers can also have
20 REM a value as a character.
30 A = 5
40 B$ = "1"
50 PRINT "A = "; A 'A is a number.
60 PRINT "B = "; B$ 'B$ is a character.
99 END
10000 REM And the answer is ...
10010 REM A = 5
10020 REM B = 1