
Lesson 5-7: Debugging
120 | Chapter 5
Name __________________________________________ Date _______________________
Section _________________________________________
Exercise 1: Program AddSub is supposed to read in a letter and two integer values and print either
the sum of the two values or the difference of the two values depending on the letter read. It is
such a simple program, but it doesn’t even compile! Correct the program and describe the errors.
Exercise 2: Now that the program compiles, run it with the following sets of values.
Input Values Means What Is Printed
A 10 20
Add 10 to 20 _____________________
A 20 10 Add 20 to 10 _____________________ ...