Simple If Walkthrough Exercises

 

There are two walkthrough exercises in the folder labeled Walkthrough Exercises on the CIS122 – Content tab . For this exercise you will walkthrough snippets of code given initial variable values to determine final values for the variables.

 

The way to do this kind of exercise is to create a column on a sheet of paper for each variable. Write the initial value as the first item in each column and then begin to "walkthrough" the code (AKA “playing computer”) recording new variable values in the appropriate column as the code indicates. After working through the code the last value in each column will be the final value. Pay very close attention to each condition as you work your way through the code. It would be a good idea to do it more than once to be sure of your results.