c语言答案-贾宗璞 许合利,c语言程序设计答案贾宗璞许合利
第1章
1選擇題
(1) C (2) B (3) D
2填空題
(1)main (2) main (3) 有窮性、確定性、有零個或多個輸入、有一個或多個輸出、有效性
(4) 順序、分支和循環(5) 自頂向下,逐步細化、模塊化設計、結構化編碼
第2章
1選擇題
BBCDA DDBBA BBDCB
2、填空題
(1) 數字、字母、下劃線 (2)0 (3) 4、8 (4) (a+b)*c/(a-b) (5) -60 6-16
73 86、4、2 90 1010、6 115.500000 12 12、4
13double 14 0 1516 166.6
3、編程題
1
main()
{
printf("int:%5d\n"
"float:%5d\n"
"char:%5d\n"
"double:%5d\n"
"long:%5d\n",
sizeof(int),+-
sizeof(float),
sizeof(char),
sizeof(double),
sizeof(long));
}
2
#define RAT 1.60934
main()
{
float k=0.0;
printf("input the km:");
scanf("%f",&k);
printf("\nmile:%f",k*RAT);
}
第3章
1選擇題
(1)~(10):DDCDCDCDBC
2解析題
(1) x=170,x=ㄩㄩㄩ170,x=ㄩㄩㄩ252, x=ㄩㄩㄩ170
x=170,x=170ㄩㄩㄩ,x=ㄩㄩㄩ170,x=%6d a=513.789185,a=ㄩㄩ513.79,a=513.78918457,a=513.78918457
(2) a=3ㄩb=7x=8.5ㄩy=71.82c1=Aㄩc2=a
3編程題
(1)
main()
{
int x,y;
scanf("%d%d",&x,&y);
printf("商數=%d,余數=%d",x/y,x%y);
system("pause");
}
(2)
main()
{
double x,y,z,avg;
scanf("%lf%lf%lf",&x,&y,&z);
avg=(x+y+z)/3;
printf("%.1lf",avg,avg);
system("pause");
}
第4章
1選擇題
(1)(10) CCAADCCABD
2填空題
(1) ch>='A' && ch<='Z' ch=ch-32
(2) x<=10 && x>2 x<=2 && x>-1 y=-1
(3) a+b>c && a+c>b && b+c>a a==b&&a==c a==b || a==c || b==c
(4) mark/10 k=1 case 9
(5) x<0 c=x/10 y!=-2
3編程題
(1)
#include
main()
{
int x;
printf("please input a number:");
scanf("%d",&x);
if(x%2==0) printf("x is a even number");
else printf("x is a odd number");
}
(2)
#include
main()
{ int x,y;
printf("please input a numbero");
scanf("%d",&x);
if(x<=-5) printf("the number is error");
else if(x<0) {y=x; printf("%d",y);}
else if(x==0) {y=x-1;printf("%d",y);}
else if(x<10) {y=x+1;printf("%d",y);}
else printf("the number is error");
}
(3)
#include
main()
{ int a,m;
printf("please input a number:");
scanf("%d",&a);
switch(a/10)
{ case 0:
case 1:
case 2:m=1;break;
case 3:m=2;break;
case 4:m=3;break;
case 5:m=4;break;
default:m=5;break;
}
printf("%d",m);
}
(4)
#include
main()
{
float price,tax;
printf("please input the price of product:");
scanf("%f",&price);
if(price>10000) tax=price*0.05;
else if(price>5000) tax=price*0.03;
else if(price>1000) tax=price*0.02;
else tax=0;
printf("%f",tax);
}
(5)
#include
main()
總結
以上是生活随笔為你收集整理的c语言答案-贾宗璞 许合利,c语言程序设计答案贾宗璞许合利的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机相关的文章,关于计算机的论文精选范
- 下一篇: 金锐四期是什么?