. 1.5
#include
printf(\
printf(\ Very good! \\n\ printf(\ }
1.6
#include
printf(\请分别输入a,b,c:\\n\ scanf(\ printf(\ }
float max(float x,float y,float z) { float m,n; m=x>y? x: y; n=m>z? m: z; return(n); }
3.6
#include
char c1=’a’,c2=’b’,c3=’c’,c4=’\\101’,c5=’\\116’; printf(“a%c b%c\\tc%c\\tabc\\n”,c1,c2,c3); printf(“\\t\\b%c %c\\n”,c4,c5);
1 / 15
. }
3.9.1
#include
z=x+a%3*(int)(x+y)%2/4; printf(\该表达式的值为:%f\
}
3.9.2
#include
int a=2,b=3;
float x=3.5,y=2.5,z;
z=(float)(a+b)/2+(int)x%(int)y; printf(\该表达式的值为:%f\ }
4.5
#include
2 / 15
. printf(\ }
4.6
#include
int a,b; float x,y; char c1,c2;
scanf(\scanf(\scanf(\}
4.7
#include
int a,b; float x,y,z; char c1,c2;
scanf(\
scanf(\scanf(\}
4.8
#include
float r,h,l,s1,s2,v1,v2;
3 / 15
. printf(\请输入r,h的值:\\n\ scanf(\ l=2*pi*r; s1=pi*r*r; s2=4*s1;
v1=4/3*pi*r*r*r; v2=s1*h;
printf(\圆周长为:%.2f\\n\printf(\圆面积为:%.2f\\n\printf(\圆球表面积为:%.2f\\n\printf(\圆球体积为:%.2f\\n\printf(\圆柱体积为:%.2f\\n\}
5.5 #include
float x,y;
printf(\请输入x的值:\\n\ scanf(\ if(x<1) y=x; else
if(x>=1&&x<10) y=2*x-1; else y=3*x-11;
printf(\与y的值分别为:\\n%f,%f\ printf(\ }
5.6 #include
4 / 15
. { float b; int a;
printf(\请输入该同学的成绩:\\n\ scanf(\ while (b<0||b>100) { printf(\输入有误,请重新输入:\\n\ scanf(\ }
a= int(b/10); if(a<6) a=5; switch(a) { case 10:
case 9: printf(\该同学为等级:A\ case 8: printf(\该同学为等级:B\ case 7: printf(\该同学为等级:C\ case 6: printf(\该同学为等级:D\ case 5: printf(\该同学为等级:E\ } }
#include
printf(\请给出一个不多于5位的正整数:\\n\ scanf(\
while(x<=0||x>=100000)
{ printf(\输入有误\\n请给出一个不多于5位的正整数:\\n\ scanf(\ }
for(n=0;n<5;n++) { y=int(x/pow(10,n));
5 / 15