大学C语言练习题Word文档下载推荐.docx
《大学C语言练习题Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《大学C语言练习题Word文档下载推荐.docx(9页珍藏版)》请在冰豆网上搜索。
![大学C语言练习题Word文档下载推荐.docx](https://file1.bdocx.com/fileroot1/2022-11/15/4c45e403-ace5-44b6-af69-057f635babcc/4c45e403-ace5-44b6-af69-057f635babcc1.gif)
ý
¾
Ý
À
Ð
Í
¡
A)Ö
Ü
Ç
0º
1B)Ö
0»
ò
0Õ
C)Ö
×
Ö
D)¿
É
È
Î
º
2£
Å
charÐ
±
ä
¿
chÊ
ª
´
¸
í
ï
A)¡
A¡
¯
<
=ch<
=¡
Z¡
B)(ch>
)&
(ch<
)
C)(ch>
&
)D)(¡
=ch)AND(¡
>
=ch)
3£
È
ô
Aµ
Æ
æ
¬
Å
Ù
ú
A)A%2==1B)!
(A%2==0)C)!
(A%2)D)A%2
4£
É
è
Ó
inta=1,b=2,c=3,d=4,m=2,n=2;
(m=a>
b)&
(n=c>
d)º
nµ
A)1B)2C)3D)4
5£
Ò
³
á
¹
main()
{inta,b,d=241;
a=d/100%9;
b=(-1)&
(-1);
printf(¡
%d,%d¡
a,b);
}
A)6,1B)2,1C)6,0D)2,0
6£
intx=10,y=20,z=30;
x,y,zµ
if(x>
y)z=x;
x=y;
y=z;
A)x=10,y=20,z=30B)x=20,y=30,z=30
C)x=20,y=30,z=10D)x=20,y=30,z=20
7£
{intm=5;
if(m++>
5)
printf(¡
%d\n¡
m);
else;
m--);
A)4B)5C)6D)7
8£
ø
xÊ
ë
12£
{intx,y;
scanf(¡
%d¡
&
x);
y=x>
12?
x+10:
x-12;
y);
A)4B)3C)2D)0
9¡
¢
a¡
b¡
c1¡
c2¡
x¡
y¾
ù
switchÓ
A£
switch(a+b);
B£
switcha
{case1:
y=a+b;
break;
{casec1:
y=a-b;
case0:
casec2:
x=a*d;
default:
x=a+b;
}}
C£
switch(a*a+b*b)D£
switch(a-b)
{case3:
{default:
y=a*b;
case1:
case3:
case3:
y=b-a;
case10:
case11:
}}
10¡
ö
#include¡
stdio.h¡
intmain()
{
inta=15,b=21,m=0;
switch(a%3)
{case0:
m++;
case1:
switch(b%2)
case0:
return0£
1B£
2C£
3D£
4
þ
1.È
100¨
L£
#include<
stdio.h>
intmain()
{inta;
a);
%s¡
(a%2!
=0)?
No¡
:
Yes¡
);
return0;
2.Ð
#include<
{inta=2,b=7,c=5;
switch(a>
0)
{
switch(b<
{case1:
@¡
break;
case2:
!
}
switch(c==5)
*¡
);
#¡
default:
\n¡
return0;
(È
î
1.Ï
Ã
Ø
xÖ
yÖ
Ú
x
y
2<
x<
=10
x(x+2)
-1<
=2
1/x
=-1
x-1
intx,y;
scanf(¡
&
if(¡
1¡
)y=x*(x+2);
elseif(¡
2¡
)y=1/x;
elseif(x<
=-1)y=x-1;
else¡
3¡
;
if(y!
=-1)printf(¡
elseprintf(¡
error¡
2.Ò
x,y,zÈ
ê
{intx=4,y=5,z=8;
intu,v;
u=x<
y?
1¡
;
v=u<
z?
2¡
printf(¡
v);
¦
÷
10½
0.15Ô
8½
0.3Ô
6½
0.4Ô
4½
0.6Ô
0.8Ô
ü
#include¡
intmain()
floatweight,money,rate;
thepaidmoneyoftheclientis:
%f¡
money);
theweightofthewatermelonis:
weight);
rate=0.15;
elseif(weight>
8)
rate=0.3;
6)
4)
rate=0.6;
rate=0.8;
theaccountpayableofthewatermelonis%f\n¡
weight*rate);
thechangeforclientis%f\n¡
money-weight*rate);
}
4¡
floatx,y;
charoperator;
pleaseinputtheexpression:
%f%c%f¡
x,&
operator,&
y);
switch(¡
{case¡
+¡
%g%c%g=%g\n¡
x,operator,y,x+y);
case¡
-¡
x,operator,y,x-y);
x,operator,y,x*y);
/¡
if(y==0.0)
else
x,operator,y,x/y);
1.±
aº
b£
a2+b2´
100£
a2+b2°
2.±
5Ó
7µ
yes£
no¡
------------------
cool