C 语言习题答案 第1 章 1.选择题 (1) C (2) B (3) A 2.填空题 (1)main (2) main (3) 有穷性、确定性、有零个或多个输入、有一个或多个输出、有效性 (4) 顺序、分支和循环(5) 自顶向下,逐步细化、模块化设计、结构化编码 第2 章 1.选择题 12 345 6 7 890 1234 5 ACCDA DCABA BBDDB 2、填空题 (1) 数字、字母、下划线 (2)0 (3) 4、8 (4) (a+b)*c/(a-b) (5) -60 (6)-16 (7)9 (8)6、4、2 (9)0 (10)10、6 (11)5
500000 (12) 12、4 (13) 0 (14)16 (15)6
6 3、编程题 (1)编写一个程序求各种类型数据的存储长度
#include main() { printf("int:%d byte\n",sizeof(int)); printf("short int:%d byte\n",sizeof(short int)); printf("long int:%d byte\n",sizeof(long int)); printf("float:%d byte\n",sizeof(float)); printf("double:%d byte\n",sizeof(double)); printf("long double:%d byte\n",sizeof(long double)); printf("char:%d byte\n",sizeof(char)); } (2) #include #define RAT 1
60934 main() { float k; printf("input the km:"); scanf("%f",&k); printf("mile:%f\n",k/RAT);