三、程序分析题(本大题共4小题,每小题4分,共16分)
阅读下列程序,将输出结果写到各题右侧的空白处。
26.
#include<stdio.h>
void main()
{ int a=0,b=2,c=3;
switch (a)
{ case 0:switch (b==2)
{ case l:printf(“*”);break;
case 2: printf (“%”);break;
}
case 1: switch (c)
{ case l:printf(“$”);break;
case 2: printf (“&”);break;
default: printf (“#”);
}
}
printf (“\n”);
}
27.
# include<stdio.h>
void fun(int *a,int *b,int x,int y)
{ *a=x+y;*b=x-y;}
void main ()
{ int c=8,d=4;
fun (&c,&d,5,10);
printf(“%d,%d\n”,c,d);
}
28.
# include<stdio.h>
int fun (int x)
{ int p;
if(x==1) return 2;
else p=x-fun (x-2);
rerurnm p;
}
void main ()
{ printf(“%d\n”,fun (9));}
29.
# include<stdio.h>
int a=10;
void f()
{ int a=30;
printf (“%d,”,a);
}
void main()
{ f ();
printf (“%d\n”,a);
}