参考答案
一、选择题
1、C 2、C 3、D 4、B 5、D 、6、A 7、C 8、C 9、D 10、A
11、C 12、C 13、D 14、C 15、B 16、C 17、D 18、D 19、C 20、B
二、阅读程序题
(1) 3.141593,3.1416,3.142 (2) 6,8 (3) 4 (4) 22 (5) 19
三、程序填空题
1、scanf(“%f”,&f); sum+=f;
2、fopen(“myfile”,w) fclose(fp);
3、x>=0.0 x<=amin
四、编程题
1、main()
{int a,b,c;
printf(“请输入三个整数:”);
scanf(“%d,%d,%d”,&a,&b,&c);
if(aif(belse printf(“max=%d\n”,b);
else if(aelse printf(“max=%d\n”,a); }
2、#include”stdio.h”
main()
{int I,n;
for(n=0,I=1900;I<=2000;I++)
{if(I%4==0&&I0!=0||I@0==0)
{printf(“%d ”,I); n++; }
if(n%3==0)
printf(“\n”); } } }
3、#include”stdio.h”
int fun(int a)
{int I;
if(a==2) return 1; I=2;
while((a%I)!=0&&I<=sqrt((float)a))
I++;
if(a%I==0)
{printf(“%d is not a prime!”,a);
return 0; }
printf(“%d is a prime!”,a);
return 1; }
main()
{int x;
printf(“\n please enter a number:”);
scanf(“%d”,&x);
printf(“%d\n”,fun(x)); }
4、#include"stdio.h"
#define N 3
struct student
{long stu_num; char sex;
char name[15]; int score[4];
float average; };
main()
{int I,j,index; float sum,max;
struct student stuarr[N];
for(I=0;I{printf("please input %d student information:\n",I+1);
scanf("%ld,%c,%s",&stuarr[I].stu_num,&stuarr[I].sex,stuarr[I].name);
for(j=0;j<4;j++)
scanf("%d",&stuarr[I].score[j]); }
for(I=0;I{sum=0.0;
for(j=0;j<4;j++)
sum+=stuarr[I].score[j];
stuarr[I].average=sum/4.0; }
max=stuarr[0].average;
index=0;
for(I=1;Iif(stuarr[I].average>max)
{max=stuarr[I].average;
index=I; }
printf("总平均成绩最高的学生信息是学号=%ld,性别=%c,姓名=%s,平均成绩=%4.1f\n",stuarr[index].stu_num,stuarr[index].sex,stuarr[index].name,stuarr[index].average);
}
更多精彩请关注读书人网计算机频道!