c语言第四章的答案

c语言第四章的答案,第1张

//如果是老谭的,你看看下面是否是你要的。

第三章 34

main()

{int a,b,c;

long int u,n;

float x,y,z;

char c1,c2;

a=3;b=4;c=5;

x=12;y=24;z=-36;

u=51274;n=128765;

c1='a';c2='b';

printf("\n");

printf("a=%2d b=%2d c=%2d\n",a,b,c);

printf("x=%86f,y=%86f,z=%96f\n",x,y,z);

printf("x+y=%52f y+z=%52f z+x=%52f\n",x+y,y+z,z+x);

printf("u=%6ld n=%9ld\n",u,n);

printf("c1='%c'or %d(ASCII)\n",c1,c1);

printf("c2='%c'or %d(ASCII)\n",c2,c2);

}

35

57

5 7

67856400,-789123962

67856400,-789123962

6786 -78912,67856400,-789123962,67856400,-789123962

6785640e+001,-789e+002

A,65,101,41

1234567,4553207,d687

65535,177777,ffff,-1

COMPUTER, COM

36

a=3 b=7/

x=85 y=7182/

c1=A c2=a/

37

10 20Aa15 -375 +14,678/

(空 3)10(空3)20Aa15(空1)-375(空1)(随意输入一个数),678 回车

38

main()

{float pi,h,r,l,s,sq,sv,sz;

pi=31415926;

printf("input r,h\n");

scanf("%f,%f",&r,&h);

l=2pir;

s=rrpi; sq=4pirr;

sv=40/30pirrr;

sz=pirrh;

printf("l=%62f\n",l);

printf("s=%62f\n",s);

printf("sq=%62f\n",sq);

printf("vq=%62f\n",sv);

printf("vz=%62f\n",sz);

}

39

main()

{float c,f;

scanf("%f",&f);

c=(50/90)(f-32);

printf("c=%52f\n",c);

}

310

#include"stdioh"

main()

{char c1,c2;

scanf("%c,%c",&c1,&c2);

putchar(c1);

putchar(c2);

printf("\n");

printf("%c%c\n",c1,c2);

}

第四章

43

(1)0 (2)1 (3)1 (4)0 (5)1

44

main()

{int a,b,c;

scanf("%d,%d,%d",&a,&b,&c);

if(a<b)

if(b<c)

printf("max=%d\n",c);

else

printf("max=%d\n",b);

else if(a<c)

printf("max=%d\n",c);

else

printf("max=%d\n",a);

}

main() {int a,b,c,temp,max;

scanf("%d,%d,%d",&a,&b,&c);

temp=(a>b)a:b;

max=(c>temp)c:temp;

printf("max=%d",max);

}

45

main()

{int x,y;

scanf("%d",&x);

if(x<1)y=x;

else if(x<10)y=2x-1;

else y=3x-11;

printf("y=%d",y);

}

46

main()

{int score,temp,logic;

char grade;

logic=1;

while(logic)

{scanf("%d",&score);

if(score>=0&&score<=100)logic=0;

}

if(score==100)

temp=9;

else

temp=(score-score%10)/10;

switch(temp)

{case 9:grade='A';break;

case 8:grade='B';break;

case 7:grade='C';break;

case 6:grade='D';break;

case 5:

case 4:

case 3:

case 2:

case 1:

case 0:grade='E';

}

printf"score=%d,grade=%c",score,grade);

}

47 main()

{long int num;

int indiv,ten,hundred,thousand,ten_thousand,place;

scanf("%ld",&num);

if(num>9999) place=5;

else if(num>999) place=4;

else if(num>99) place=3;

else if(num>9) place=2;

else place=1;

printf("place=%d\n",place);

ten_thousand=num/10000;

thousand=(num-ten_thousand10000)/1000;

hundred=(num-ten_thousand10000-thousand1000)/100;

ten=(num-ten_thousand10000-thousand1000-hundred100)/10;

indiv=num-ten_thousand10000-thousand1000-hundred100-ten10;

switch(place)

{case 5:printf("%d,%d,%d,%d,%d\n",ten_thousand,thousand,hundred,ten,indiv);

printf("%d,%d,%d,%d,%d\n",indiv,ten,hundred,thousand,ten_thousand);

break;

case 4:printf("%d,%d,%d,%d\n",thousand,hundred,ten,indiv);

printf("%d,%d,%d,%d\n",indiv,ten,hundred,thousand);

break;

case 3:printf("%d,%d,%d\n",hundred,ten,indiv);

printf("%d,%d,%d\n",indiv,ten,hundred);

break;

case 2:printf("%d,%d\n",ten,indiv);

printf("%d,%d\n",indiv,ten);

break;

case 1:printf("%d\n",indiv);

printf("%d\n",indiv);

}

}

48

main()

{long i;

float bonus,bon1,bon2,bon4,bon6,bon10;

bon1=10000001;

bon2=bon1+1000000075;

bon4=bon2+200000005;

bon6=bon4+200000003;

bon10=bon6+4000000015;

scanf("%ld",&i);

if(i<=1e5)bonus=i01;

else if(i<=2e5)bonus=bon1+(i-100000)0075; else if(i<=4e5)bonus=bon2+(i-200000)005;

else if(i<=6e5)bonus=bon4+(i-400000)003;

else if(i<=1e6)bonus=bon6+(i-600000)0015;

else bonus=bon10+(i-1000000)001;

printf("bonus=%102f",bonus);

}

main()

{long i;

float bonus,bon1,bon2,bon4,bon6,bon10;

int branch;

bon1=10000001;

bon2=bon1+1000000075;

bon4=bon2+200000005;

bon6=bon4+200000003;

bon10=bon6+4000000015;

scanf("%ld",&i);

branch=i/100000;

if(branch>10)branch=10;

switch(branch)

{case 0:bonus=i01;break;

case 1:bonus=bon1+(i-100000)0075;break;

case 2:

case 3:bonus=bon2+(i-200000)005;break;

case 4:

case 5:bonus=bon4+(i-400000)003;break;

case 6:

case 7

case 8:

case 9:bonus=bon6+(i-600000)0015;break;

case 10:bonus=bon10+(i-1000000)001;

}

printf("bonus=%102f",bonus);

}

49

main()

{int t,a,b,c,d;

scanf("%d,%d,%d,%d",&a,&b,&c,&d);

if(a>b){t=a;a=b;b=t;}

if(a>c){t=a;a=c;c=t;}

if(a>d){t=a;a=d;d=t;}

if(b>c){t=b;b=c;c=t;}

if(b>d){t=b;b=d;d=t;}

if(c>d){t=c;c=d;d=t;} printf("%d %d %d %d\n",a,b,c,d);

}

410

main()

{int h=10;

float x,y,x0=2,y0=2,d1,d2,d3,d4;

scanf("%f,%f",&x,&y);

d1=(x-x0)(x-x0)+(y-y0)(y-y0);

d2=(x-x0)(x-x0)+(y+y0)(y+y0);

d3=(x+x0)(x+x0)+(y-y0)(y-y0);

d4=(x+x0)(x+x0)+(y+y0)(y+y0);

if(d1>1&&d2>1&&d3>1&&d4>1)h=0;

printf("h=%d",h);

}

大学学习资料免费下载网 有

在 其他公共课程 版块

标题:

C语言程序设计第三版谭浩强课后习题答案完整版txt

谭浩强C语言程序设计习题参考解答

C程序设计题解与上机指导 答案

还有很多相关资料:

谭浩强编《C语言程序设计》视频教程(曾怡讲解) 在线 下载

谭浩强编《C语言程序设计》(电子书+纸质书)

下载不用积分

我可以帮助你,你先设置我最佳答案后,我百度Hii教你。

以上就是关于c语言第四章的答案全部的内容,包括:c语言第四章的答案、c语言程序设计课后习题答案(高等教育出版社何钦铭 颜晖 主编)、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9365009.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-27
下一篇 2023-04-27

发表评论

登录后才能评论

评论列表(0条)

保存