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 the INPUT statement with 20 REM numbers and characters. 30 PRINT "Input a word at the ? prompt." 40 INPUT X$ ' Assume that you enter Basic at the ? prompt. 50 PRINT "Input a number at the ? prompt." 60 INPUT Y ' Assume that you enter 9 at the ? prompt. 70 PRINT "The word is "; X$ 80 PRINT "The number is "; Y 99 END 10000 REM And the answer is ... 10010 REM The word is Basic 10020 REM The number is 9