Hints for Chapter 3: Basic Programming Constructs
Problem 7: local variables of types int and double
For part (a),
- first variables width and height both of type int are declared;
- then width is assigned the value 4;
- then height is assigned the value width*2, i.e. 8;
- then the variable area of type int is declared and assigned the value resulting
from the product of the values of width and height, i.e. 4*8, which is 32;
- finally the value of area, i.e. 32, is displayed in the Output window.
Try part (b) before looking at the next hint.
Next Hint