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 numerical accuracy.
20 X = 1/2
30 Y = 1/3
40 IF X = .5 THEN PRINT "X = 0.5"
50 IF Y = .33337 THEN PRINT "Y <> .33337"
99 END
10000 REM X = 0.5

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

There have been [an error occurred while processing this directive] visitors to this page since February 1, 1999.