| 
 | 
 
Answers to Selected Exercises  
2. [was #2] (a) The program contains one directive (#include) and four statements (three calls of printf and one return). (b)   
Parkinson's Law:  
Work expands so as to fill the time available for its completion. 3. [was #4]  
#include <stdio.h>   
int main(void) {  
  int height = 8, length = 12, width = 10, volume;   
  volume = height * length * width;   
  printf("Dimensions: %dx%dx%d\n", length, width, height);   printf("Volume (cubic inches): %d\n", volume);  
  printf("Dimensional weight (pounds): %d\n", (volume + 165) / 166);   
  return 0; }  
4. [was #6] Here's one possible program: #include <stdio.h>   
int main(void) {  
  int i, j, k;   float x, y, z;   
  printf("Value of i: %d\n", i);   printf("Value of j: %d\n", j);   printf("Value of k: %d\n", k);   
  printf("Value of x: %g\n", x);   printf("Value of y: %g\n", y); 
 
完整课后答案请下载附件,回复本帖子即可查看解压密码 
 
 
 
 |   
 
 
 
 |