Exercise 3.10 (Multiple Assignment)
1. Ensure you have viewed the video (associated with this exercise) at this link >>
2. Consider the program below (Exercise 3.10 Example 1). The programmer wanted the program to swap the values in the variable a and b. However, it does not work in the way the programmer expected. Explain why the program fails to swap the values.
Exercise 3.10 Example 1
3. Rewrite the program above so that it uses a third variable called temp that fixes the program so that the content of variables a and b are successfully swapped.
4. Rewrite the program again so that it swaps the content in variables a and b but this time without using a third variable.
END Next Exercise >>