3。1 main( )
int x;
printf(“please input x=”);
scanf(“%d”,&x);
if(!(x%2))printf(“\n%d is a oushu “,x);
else printf(“\n%d is a jishu “,x);
3。
2
main()
int a,b,c,t;
printf(“please input a,b,c=”);
scanf(“%d,%d,%d”,&a,&b,&c);
if(ab)max=a; /*能够利用前提表达式来完成max=(a>b?a,b)>c? (a>b?a,b):c;*/
else max=b;
if(max-10&&x0&&x=10)printf(“\n x=%d,do nothing”,x);
else printf(“ y=%d”,y);
(2)main( )
{int x,y;
printf(“please input x=”);
scanf(“%d”,&x);
if(x>-10&&x=10)printf(“\n x=%d,do nothing”,x);
else if(x0) printf(“\n x=%d,y=2*x+1=%d”,x,2*x+1);
else ; /*那个语句能够省略,因为它是一个空语句,什么也不做*/
if(x0) printf(“\n x=%d,y=2*x+1=%d”,x,2*x+1);
else printf(“\n x=%d,do nothing”,x);
3。
6 a=3,b=4,c=5
(1) a+b>c&&b==c
(2) a||b+c&&b-c
(3) !(a>b)&&!c||1
(4) !(x=a)&&(y=b)&&0
(5) !(a+b)+c-1&&b+c/2
谜底:0,1,1,0,1
3。
7
(1) a+b>c&&b+c>a&&c+a>b , abs(a-b)=’a’&&ch=’A’&&chc&&b+c>a&&c+a>b)
{ k=(a+b+c)/2。0;
mianji=sqrt(k*fabs(k-a)*fabs(k-b)*fabs(k-c));
printf(“mianji=%f”,mianji);
else printf(“a,b,c can’t make a sanjiaoxing “);
3。
9
main()
{int x;
printf(“please input x=);
scanf(“%d”,&x);
switch(x%7)
{ case 0 :printf(“\n日曜日”);break;
case1 :printf(“\n礼拜一”); break;
case 2 :printf(“\n礼拜二”); break;
case 3 :printf(“\n礼拜三”); break;
case 4 :printf(“\n木曜日”); break;
case 5 :printf(“\n礼拜五”); break;
case 6 :printf(“\n礼拜六”);
3.10
(1) main()
{ int x,y;
printf(“plese input x,y=”);
scanf(“%d,%d”,&x,&y);
if(x>0&&y>0)printf(“x,y is in I xiangxian”);
if(x0)printf(“x,y is in II xiangxian”);
if(x0&&y0)
if(y>0) printf(“x,y is in I xiangxian”);
else printf(“x,y is in IV xiangxian”);
else
if(y>0) printf(“x,y is in II xiangxian”);
else printf(“x,y is in III xiangxian”);
else printf(“x,y is in 0 xiangxian”);
(7) main()
{int x,y;
printf(“plese input x,y=”);
scanf(“%d,%d”,&x,&y);
if(x>0&&y>0)printf(“x,y is in I xiangxian”);
else if(x0)printf(“x,y is in II xiangxian”);
else if(x0&&y