카테고리 없음

Exercise 2.1~2.8 2017/03/22

plzfday 2017. 3. 29. 12:04

2.

 (a)   directives : #include ,
              statements : 
          printf 3개 return 1개 -> 총 4개

       (b) Parkinson's Law:
            Work expands so as to fill the time
            available for its completion.

3.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
int main(void)
{
        int height, length, width,volume;
        height = 8;
        length = 12;
        width = 10;
        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;
}
 
cs

4.(디버그 오류가 생기는 듯하다.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
int main(void)
{
        int a, b, c;
        float x, y, z;
        printf("Value of a: %d\n", a);
        printf("Value of b: %d\n", b);
        printf("Value of c: %d\n", c);
        
        printf("Value of x: %g\n", x);
        printf("Value of y: %g\n", y);
        printf("Value of z: %g\n", z);
        
        return 0;
}
 
cs

5.

(a) - 숫자 먼저 나오면 안됌.

6.

구별하기가 어렵고 딱 봤을때 별로 좋아보이지 않는다.

7.

(a),(d),(e)

8.

answer의 a, =, (, 3, *, q, -, p, *, p, ), /, 3 그리고 ; ----- 총 14개

9.

answer = (3 * q - p * p) / 3;

10.

1
2
3
#include <stdio.h>
int main(void){int height,length,width,volume;height=8;length=12;width=10;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;}
 
cs