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 order of operations
20 REM by the use of ( and ).
30 A = 1 + 2 + 4 / 2 * 3
40 PRINT A
50 A = (1 + 2) + 4 / (2 * 3)
60 PRINT A
99 END
10000 REM And the answer is ...
10010 REM 9
10020 REM 3.666667