77范文网 - 专业文章范例文档资料分享平台

C语言习题答案 贾宗璞 许合利 较全-

来源:网络收集 时间:2018-11-11 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

参考答案 习题一 1、 选择题 CBACD 2、 填空题 1) main()

2) main()

3) 有穷性、确定性、有效性、0个到多个输入、1个到多个输出 4) 顺序、选择、循环

5) 自顶向下、逐步细化、模块化设计、限制goto

习题二

1、 选择题

ACCDA DDAAC BBACC

2、 填空题

1) 字母、数字、下划线 2) 0

3) 4 8

4) ( a + b ) * c / ( a – c ) 5) -60

6) -16 7) 9

8) 6 4 2 9) 0 10) 10 6 11) 12 4 12) 3.500000 13) 0 14)

16

15) 6.6 3、编程题

//(1)编写一个程序求各种类型数据的存储长度。 #include void main() { printf(\

printf(\ printf(\ printf(\ printf(\

printf(\ printf(\

}

1

#include #define RAT 1.60934 void main() { float k; printf(\ scanf(\

printf(\T);

}

习题三

1、 选择题 DACDD DCDCC 2、 解析题 1)

#include void main() { int x=170;

float a=513.789215;

printf(\ printf(\ printf(\}

结果:

x=170,x= 170,x= 252,x= aa,x= 170

x=170,x=170 ,x= 170,x=m

a=513.789185,a= 513.79,a= 513.78918457,a= 513.78918457

2) #include main() { int a,b; float x,y;

char c1,c2;

scanf(\ scanf(\

scanf(\

printf(\,c1,c2); }

正确输入格式:

A=3 b=7x=8.5 y=71.82c1=A c2=a

3、 编程题

1)

#include void main()

2

{

int x,y;

scanf(\

printf(\商数=%d,余数=%d\ }

2) #include void main() {

double x,y,z,avg;

scanf(\ avg=(x+y+z)/3; printf(\}

习题四

1、 选择题 CCAAD CCABD

2、 填空题

1)

① a>0&&b>0||a>0&&c>0||b>0&&c>0 ② a5 ④ a<=0

⑤ a%b!=0

2) ① !(x>0) ② 1 ③ !(x>=0&&x<=5) 3) 3 2 2

4) ch>=’A’ && ch<=’Z’ ch=ch-32

5) x>2&&x<=10 x>-1&&x<=2 y= -1

6) a+b>c && b+c>a && a+c>b a==b && c==a 7) x<0 c=x/10 x != -2

3、 编程题 1)

#include main() { int x;

printf(\ scanf(\

if(x%2==0) printf(\ else printf(\} 2)

#include

a==b || b==c || a==c 3

main()

{

int x,y;

printf(\ scanf(\

if(x>-5 && x<0) { y=x; printf(\ } else if(x==0) { y=x-1; printf(\ } else if(x>0 && x<10) { y=x+1; printf(\ } else printf(\}

3)

#include main() { int a,m;

printf(\ scanf(\ 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(\}

4)

#include main()

{

float price,tax;

printf(\ scanf(\

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(\} 5)

#include main() {

4

float score;

printf(\ scanf(\

if(score>=85) printf(\ else if(score>=60) printf(\ else printf(\}

6)

#include main () { int x,y,z; printf(\ scanf(\ if(x<10 || x>99 || y<10 || y>99) printf(\

else

{ z=(x/10)*1000+(y/10)*100+(x)*10+y; printf(\ }

}

习题五 1、 选择题

DCADA DDBDB CADAC 2、 填空题

1) fahr celsius=5.0/9*(fahr-32); fahr+=step; 2) i=5 j=4 k=6 3) 3*i-2

4) y-- z*=x

5) 8 5 2

6) j++ i%j==0 j==i 7) sum

#include main()

{ int n,k;

float score,sum,ave;

/**********found**********/ for(n=1;n<=10;n++) { sum=0.0;

for(k=1;k<=4;k++)

5

{ scanf(\ sum+=score; }

/**********found**********/ ave=sum/4;

printf(\ } } 2)

#include main()

{ int i,j,k,m;

for(i=1; i<=9; i++)

/*********found **********/ for(j=0; j<=9 ; j++) for(k=0; k<=9; k++)

{ /********* found *********/ m=100*i+10*j+k;

if(m==i*i*i+j*j*j+k*k*k) } } 3)

#include main() {

double r,eps,temp; int m=1;

printf(\ scanf(\ r=0.0;

/*******found*********/ temp=1;

/********found********/ while(temp >=eps) {

r+=temp;

temp=(temp*m)/(2*m+1); m++; }

/********found********/

printf(\} 4)

#include

printf(\\6

main()

{

int m=0,mix=0,n;

/********found********/ scanf(\

while((n>=2) && (mix<10)) { /*******found*********/ if((n==0) || (n==0)) {

m=m+n; mix++; } n--; }

printf(\} 5)

#include main()

{ unsigned m; int n=0,max=0,t;

scanf(\ do {

/*******found********/ t=m;

/*******found********/ if(t==0) n++; if(max

/*******found********/ m=m/10; } while(m);

printf(\}

4、 编程题 1)

#include main() { int s; float n,t,sum;

t=1; sum=0; n=1; s=1.0; while(n<=100)

{

7

sum=sum+t; n=n+1; s=-s; t=s/n; }

printf(\

} 2)

#include main() {

int i;

long int n=1;

for(i=1;i<=10;i++) { n=n*i;

printf(i%5==0?\ } } 3)

#include main() {

int n,i,j;

scanf(\ for(i=1;i<=n;i++)

{ for(j=1;j<=n+i-1;j++) if(j<=n-i) printf(\ else printf(\ printf(\ } } 4)

#include main() {

int m,s,i;

for(m=2;m<1000;m++) { s=0;

for(i=1;i

if(s==m) { printf(\ for(i=1;i

8

if(m%i==0) printf(\

printf(\ } } } 5)

#include main() {

int h10,h7,h5;

for(h10=0; h10<=8; h10++) for(h7=0; h7<=8; h7++) for(h5=0; h5<=8; h5++)

if(h10+h7+h5==8 && h10*10+h7*7+h5*5==53)

printf(\

} 6)

#include main() { int day,x1,x2;

day=9; x2=1;

while(day>0)

{ x1=(x2+1)*2; //第一天的桃子数是第2天桃子数加1后的2倍 x2=x1;

day--;

} printf(\ } 7)

#include #include main() { float x,x0,f,f1;

x=1.5; //可改为scanf(\ do { x0=x;

f=2*x0*x0*x0-4*x0*x0+3*x0-6;

f1=6*x0*x0-8*x0+3; // f的导数,即它的切线

x=x0-f/f1; // 切线与x轴的交点

}while(fabs(x-x0)>=1e-5); printf(\ }

9

8)

#include main()

{ int p,r,n,m,temp;

printf(\ scanf(\

if(n

{ temp=n; n=m; m=temp; } //确保m>n p=n*m; while(m!=0) {

r=n%m; n=m; m=r;

}

printf(\ //最大公约数 printf(\ //最小公倍数 }

10

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C语言习题答案 贾宗璞 许合利 较全-在线全文阅读。

C语言习题答案 贾宗璞 许合利 较全-.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/266158.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: