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 variables and simple math.
20 X = 10
30 PRINT "X = "; X
40 Y = 100
50 PRINT "Y = "; Y
60 Z = X * Y
70 PRINT "Z + 10 = "; Z + 10
99 END
10000 REM And the answer is ...
10010 REM X =  10
10020 REM Y =  100
10030 REM Z + 10 =  1010

Please send comments or suggestions to Dr. Thomas W. MacFarland

There have been visitors to this page since February 1, 1999.