return(sum); }
9-2-2
#include
{ int days(int year,int month,int day); int days(int,int,int); int day_sum;
printf(\
scanf(\ day_sum=days(date.year,date.month,date.day);
printf(\}
int days(int year,int month,int day) {int day_sum,i;
int day_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; day_sum=0;
for (i=1;i if ((year%4==0 && year0!=0 || year%4==0) && month>=3) day_sum+=1; return(day_sum); } 9-3 #include struct student { char num[6]; char name[8]; int score[4]; }stu[N]; int main() {void print(struct student stu[6]); int i,j; for (i=0;i {printf(\ printf(\ scanf(\ printf(\ scanf(\ for (j=0;j<3;j++) {printf(\ scanf(\ } printf(\} print(stu); return 0; } void print(struct student stu[6]) {int i,j; printf(\ NO. name score1 score2 for (i=0;i {printf(\ for (j=0;j<3;j++) printf(\ printf(\ } } 9-4 #include struct student {char num[6]; char name[8]; int score[4]; } stu[N]; int main() {void input(struct student stu[]); void print(struct student stu[]); input(stu); score3\\n\ print(stu); return 0; } void input(struct student stu[]) {int i,j; for (i=0;i {printf(\ printf(\ scanf(\ printf(\ \ scanf(\ for (j=0;j<3;j++) {printf(\ scanf(\ } printf(\ } } void print(struct student stu[6]) {int i,j; printf(\ NO. name score1 score2 \\n\ for (i=0;i {printf(\ for (j=0;j<3;j++) printf(\ printf(\ } 9-5 #include int main() score3 { int i,j,maxi; float sum,max,average; for (i=0;i {printf(\ printf(\ scanf(\ printf(\ scanf(\ for (j=0;j<3;j++) {printf(\ scanf(\ } } average=0; max=0; maxi=0; for (i=0;i for (j=0;j<3;j++) sum+=stu[i].score[j]; stu[i].avr=sum/3.0; average+=stu[i].avr; if (sum>max) {max=sum; maxi=i; } } average/=N; printf(\ NO. name score1 score2 score3 average\\n\ for (i=0;i {printf(\ for (j=0;j<3;j++) printf(\ printf(\ %8.2f\\n\ } printf(\ printf(\ printf(\ stu[maxi].score[0],stu[maxi].score[1],stu[maxi].score[2],stu[maxi].avr); return 0; } 9-6 #include struct person {int number; int nextp; } link[N+1]; int main() {int i,count,h; for (i=1;i<=N;i++) {if (i==N) link[i].nextp=1; else link[i].nextp=i+1; link[i].number=i; } printf(\ count=0; h=N; printf(\ while(count while(i!=3) {h=link[h].nextp; if (link[h].number) i++; } printf(\ link[h].number=0; count++; } printf(\ for (i=1;i<=N;i++) if (link[i].number) printf(\ printf(\ return 0; } 9-7 #include